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, Ed, biapar, Willr, Ingo, swaiba

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

Go to End

2 Posts   1956 Views


Community Member, 23 Posts

19 February 2012 at 5:32pm

Edited: 22/02/2012 12:54pm


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?



Community Member, 23 Posts

19 February 2012 at 5:45pm

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.