Hello everyone,
I use Static Pages plugin, and I have created own plugin to add custom fields for staticMenu with viewBag as stated in plugin docs, but I’m stuck on field translation. I need separate input values for each language, so when i change Multisite language in backend, input value changes also.
Anyone got success with this in october v3 ?
Thanks
My code:
public function boot()
{
Event::listen('backend.form.extendFieldsBefore', function ($widget) {
if (
!$widget->getController() instanceof \RainLab\Pages\Controllers\Index ||
!$widget->model instanceof \RainLab\Pages\Classes\MenuItem
) {
return;
}
$widget->addFields([
'viewBag[menuItemDescription]' => [
'label' => 'Menu item description',
'type' => 'text'
]
]);
// Mark the field as translatable
$widget->model->translatable[] = 'viewBag[menuItemDescription]';
});
}