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.

General Questions

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

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

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


2 Posts   1020 Views


19 February 2012 at 5:32pm (Last edited: 22 February 2012 12:54pm), Community Member, 23 Posts


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?



19 February 2012 at 5:45pm Community Member, 23 Posts

I found the answer on Stack Overflow:

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.