Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How do I insert a tab before another tab?

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

Page: 1
Go to End
Author Topic: 857 Views
  • 1nsane
    Avatar
    Community Member
    14 Posts

    How do I insert a tab before another tab? Link to this post

    I am trying to insert a new admin tab before Root.Content.Main without any luck. I've tried:

          $fields->insertBefore(new Tab('Root.Content.Overview', 'Overview'), 'Root.Content.Main');

    and

    $fields->addFieldToTab('Root.Content', new Tab('OverviewTab', 'Root.Content.Overview'), 'Root.Content.Main');

    without any luck.

    Anyone have any ideas? I've hunted through the API but there isn't much explanation as to how the tab naming system works.

  • 1nsane
    Avatar
    Community Member
    14 Posts

    Re: How do I insert a tab before another tab? Link to this post

    Figured it out...

    $fields->insertBefore(new Tab('Overview', 'Project Overview'), 'Main');

  • omarkohl
    Avatar
    Community Member
    30 Posts

    Re: How do I insert a tab before another tab? Link to this post

    This should work as well:

    $fields->addFieldToTab('Root.Content', new Tab('OverviewTab', 'Root.Content.Overview'), 'Main');

    Notice that the last parameter is not the whole path of the tab, just the name. It is implied that it 'Main' must belong to 'Root.Content'.

    857 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.