23367 Posts in 18143 Topics by 2863 members
|Go to End|
19 February 2012 at 5:32pm Last edited: 22 February 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?
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.
|Go to Top|