octobro
octobro

I am trying to create a mega menu that works with the static pages plugin. I can get a basic dynamic menu going but not sure how to approach the images. I would like to somehow tie the images with the static page. Not all pages will have an image. Is this possible to create?

Example image here

chris15853
chris15853

I am trying to achieve the same thing. Did you manage to create a solution?

jawainc16180
jawainc16180

same here, i've tried creating a 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'
                ],

            ]);
        });
}

Any suggestions ..

jan-vince
jan-vince

Actually it works, but mediafinder widget do not show image preview.

If you select images, apply changes and save menu, image/file path is saved - you can check it by changing mediafinder field type to text.

And you can use image in Twig with menuitem.viewBag.menu_item_image.

So the only problem is how to show saved images preview.

I have this in my todo list for a long time so I will try to find a solution and implement it in my Small Extensions plugin.

1-5 of 5