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

Move "Metadata" tab to end


Reply

4 Posts   1651 Views

Avatar
DeklinKelly

6 May 2009 at 6:38am Community Member, 197 Posts

I have created several custom tabs. Now I want to move the "Metadata" tab to end.

Avatar
Howard

6 May 2009 at 1:08pm Community Member, 215 Posts

I am pretty sure this can be done by removing it then adding it in again at the end, ie:

 $f->removeFieldFromTab("Root.Content","Metadata");
$f->addFieldToTab("Root.Content","Metadata");

Avatar
DeklinKelly

6 May 2009 at 11:28pm Community Member, 197 Posts

Howard, your idea does not work.

The first line successfully removes the Metadata tab, but when I add the second tab I get an error:

Fatal error: Call to a member function Name() on a non-object in FieldSet.php on line 393

It seems that it cannot be added again because it was removed.

Avatar
chadws

18 June 2009 at 2:25am Community Member, 9 Posts

This worked for me:

$metadataTab = $fields->findOrMakeTab('Root.Content.Metadata');
$fields->removeByName('Metadata');
$fields->addFieldToTab('Root.Content', $metadataTab);