This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Adam
Adam

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

Gbaumeister
Gbaumeister

+1, cannot find anything in the docs. Looking for the same thing.

vdomah
vdomah

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

zakir2229
zakir2229

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.

phplee
phplee

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

Tainui
Tainui

@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

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.