Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Sorting tabs


Go to End


5 Posts   2537 Views

Avatar
mco

Community Member, 14 Posts

22 April 2010 at 9:50pm

Hi,

I need to add a new tab to a Page (Main, Behavior, Todo, ...) but I don't want to add it to the end but insert it between "Main" and "Behavior".
Is there a insertFieldToTab instead of addFieldToTab or something else to custom re-sort the tab list?

Thanks in advance,
CM

Avatar
Willr

Forum Moderator, 5523 Posts

23 April 2010 at 8:53pm

Hmm off the top of my head and a quick look I can't see anything. In 2.4 I can see a changeFieldOrder() function on FieldSet which may be what your looking for.

Not completely sure if these will work but I think they may $fields->insertAfter(), $fields->insertBefore(). The tabs in the CMS are standard form fields so you might be able to move them round using those.

If you have any luck would like to hear what worked.

Avatar
klikhier

Community Member, 150 Posts

3 June 2010 at 12:28am

Have tried various options but suggestions don't seem to be working (unfortunately).

Avatar
peterk

Community Member, 3 Posts

12 July 2011 at 1:06pm

Hey,

it's as easy as one would guess - but i've searched for it like hours. Here is the solution:

First create a new Tab:

$fields->addFieldToTab("Root.Content", new Tab("Images"), "Metadata");

and then add whatever you want to your Tab:

$fields->addFieldToTab("Root.Content.Images", new Textfield("Test));

Hope it helps,

W

Avatar
monkeyben

Community Member, 25 Posts

19 September 2011 at 11:04pm

That works, thank you peterk :)