Hi.
I want to add an image to the menu, but when i follow the documentation, the menu page doesn’t function normaly.
If i add a text field or another field, the documentaiton is ok.
So this is the code, i have added to my boot function :
Event::listen('backend.form.extendFields', function ($widget) {
// Only apply this listener when the Page controller is being used
if (!$widget->getController() instanceof \RainLab\Pages\Controllers\Index) {
return;
}
// Only apply this listener when the MenuItem model is being modified
if (!$widget->model instanceof \RainLab\Pages\Classes\MenuItem) {
return;
}
// Only apply this listener when the Form widget in question is a root-level
// Form widget (not a repeater, nestedform, etc)
if ($widget->isNested) {
return;
}
// Add an extra birthday field
$widget->addTabFields([
'viewBag[menuImage]' => [
'label' => 'Menu Image',
'commentAbove' => 'Selectionnez l image du menu',
'field' => 'viewBag[menuImage]',
'type' => 'mediafinder',
'mode' => 'image',
'tab' => 'Media'
]
]);
});
And the result :
In the menu page, the apply and Cancel Button are on the bottom of the page and doesn’t function. (They should be the in the modal window.)
I also test with the Small Extension Plugin, but the result is the same.
Is there a solution to fix this bug ?
Thanks.