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

[SOLVED] Add tab before 'Metadata' in the CMS


Go to End


2 Posts   2509 Views

Avatar
jizzman

Community Member, 23 Posts

19 February 2012 at 5:32pm

Edited: 22/02/2012 12:54pm

Hi,

Probably another easy one. I'd like to add tabs so that the 'Metadata' is always the last in the tab set. For instance I have a two column page layout (left/right) and here I try to add the right column tab so it appears before the 'Metadata' tab in the CMS:

$fields->addFieldToTab('Root.Content.RightColumn', new HtmlEditorField('Right_', 'Right Side'), 'Metadata');

This doesn't seem to work. I still end up with tab order [Main|Metadata|Right Side]

Is there something special about the 'Metadata' tab?

Thanks,
J

Avatar
jizzman

Community Member, 23 Posts

19 February 2012 at 5:45pm

I found the answer on Stack Overflow: http://stackoverflow.com/questions/5033028/silverstripe-how-do-i-insert-a-tab-before-another-tab

For anyone else, the solution is to first create the tab manually so you can position it:

$fields->insertBefore(new Tab('MyNewTab', 'My New Tab'), 'Metadata');

and then just add your fields to the new tab:

$fields->addFieldToTab('Root.Content.MyNewTab', new TextField(...));

My problem was letting addFieldToTab() create the tab automatically; in that case you can't manually position it.