This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I'm adding some fields to the rainlab user plugin and these are in their own tab. Is there a way to override the order of the tabs. Ideally I need to show these fields in their own tab first (ie before the Contact Details) tab.
Cheers,
Adam
You can do it like this in Controller::extend
$fields = $form->getTabs()->primary->fields;
$order_tabs_by_this_arr = ['your_tab_name_or_lang_code', 'tab_second'];
$form->getTabs()->primary->fields = array_merge(array_flip($order_tabs_by_this_arr),
$fields
);
Last updated
vdomah said:
You can do it like this in Controller::extend
$fields = $form->getTabs()->primary->fields; $order_tabs_by_this_arr = ['your_tab_name_or_lang_code', 'tab_second']; $form->getTabs()->primary->fields = array_merge(array_flip($order_tabs_by_this_arr), $fields );
Good heck. you solution works great for normal form fields but not working for repeater widget field.
Hi,
Can you give me an example of how to implement this in my plugin file.
im extending like this
Event::listen('backend.form.extendFields', function($widget) {
thanks
Last updated
@phplee, just replace $form by $widget :
<code>
Event::listen('backend.form.extendFields', function($widget) {
$fields = $widget->getTabs()->primary->fields;
$order_tabs_by_this_arr = ['your_tab_name_or_lang_code', 'tab_second'];
$widget->getTabs()->primary->fields = array_merge(array_flip($order_tabs_by_this_arr), $fields);
});
</code>
and thanks to @vdomah :)
Last updated
1-6 of 6