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.

Customising the CMS /

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

How do I insert a tab before another tab?


Go to End


3 Posts   2408 Views

Avatar
1nsane

Community Member, 14 Posts

18 February 2011 at 7:35am

I am trying to insert a new admin tab before Root.Content.Main without any luck. I've tried:

$fields->insertBefore(new Tab('Root.Content.Overview', 'Overview'), 'Root.Content.Main');

and

$fields->addFieldToTab('Root.Content', new Tab('OverviewTab', 'Root.Content.Overview'), 'Root.Content.Main');

without any luck.

Anyone have any ideas? I've hunted through the API but there isn't much explanation as to how the tab naming system works.

Avatar
1nsane

Community Member, 14 Posts

18 February 2011 at 9:09am

Figured it out...

$fields->insertBefore(new Tab('Overview', 'Project Overview'), 'Main');

Avatar
omarkohl

Community Member, 30 Posts

19 February 2011 at 12:20am

This should work as well:

$fields->addFieldToTab('Root.Content', new Tab('OverviewTab', 'Root.Content.Overview'), 'Main');

Notice that the last parameter is not the whole path of the tab, just the name. It is implied that it 'Main' must belong to 'Root.Content'.