jawainc16180
jawainc16180

I'm building plugin to add image in menu but it did not work

public function boot()
    {
// Menu
        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[menu_item_image]' => [
                    'tab' => 'Menu Image',
                    'label' => 'Menu Item Image',
                    'comment' => 'Menu item image will be shown with title',
                    'type'=> 'mediafinder',
                    'mode' => 'image'
                ],

            ]);
        });
}

it shows new tab with image placeholder, but it never save selected image.

Any suggestions ?

1-1 of 1