Hi, I have extended the Static Pages Menu Item by using the below code which adds a media finder option to a menu item. The problem i am having is that once the user select the image to use and hits "Apply", if they return to the menu item the selected image is no longer visible. Any ideas how i might be able to fix this?
I've tried to use "fileupload" as the "type" but I get an error stating that the MenuItem model does not contain a definition for viewBag[menuImage]. Am I able to use "fileupload" as the type and add a definition in the MenuItem Model without directly editing the RainLab\Pages\Classes\MenuItem file?
Currently i have implemented the below in a separate plugin.php file.
Event::listen('backend.form.extendFields', function ($widget) { if ( !$widget->getController() instanceof \RainLab\Pages\Controllers\Index || !$widget->model instanceof \RainLab\Pages\Classes\MenuItem ) { return; } $widget->addTabFields([ 'viewBag[menuImage]' => [ 'tab' => 'Media', 'label' => 'Menu Image', 'commentAbove' => 'Add an image to appear in the menu', 'type' => 'mediafinder', 'mode' => 'image' ] ]); });