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.

Customising the CMS /

Add Third Level Tabs


Reply


4 Posts   2288 Views

Avatar
DeklinKelly

Community Member, 197 Posts

26 July 2010 at 1:13pm

How can I create a third level of tabs in the administrative area of the CMS?

I can create a new tab named "Zooph" like this:

$fields->addFieldToTab("Root.Content.Zooph", new LiteralField('CustomCode1','Hello World'));

But how can I create a deeper level of tabs under "Zooph"?

Avatar
Willr

Forum Moderator, 5513 Posts

26 July 2010 at 1:42pm

AFAIK you can only create 2 levels. If Root.Content.Zooph.Test doesn't work then I would assume it doesn't work.

Avatar
Martijn

Community Member, 271 Posts

28 July 2010 at 5:08am

Edited: 28/07/2010 5:09am

You can add new TabSets easily:

function getCMSFields() {
      $fields = parent::getCMSFields();
      
      $fields->addFieldToTab("Root.Content.ContentBlocks",new TabSet('ContentBlockSet',
         new Tab('HeaderContent', new HTMLEditorField("HeaderContent")),
         new Tab('LeftContent', new HTMLEditorField("LeftContent")),
         new Tab('RightContent', new HTMLEditorField("RightContent"))
      ));
      
      $fields->addFieldToTab("Root.Content.Widgets",new TabSet('WidgetsSet',
         new Tab('WidgetsLeftTop', new WidgetAreaEditor("WidgetsLeftTopArea")),
         new Tab('WidgetsLeftBottom', new WidgetAreaEditor("WidgetsLeftBottomArea")),
         new Tab('WidgetsRightTop', new WidgetAreaEditor("WidgetsRightTopArea")),
         new Tab('WidgetsRightBottom', new WidgetAreaEditor("WidgetsRightBottomArea"))
      ));

      return $fields;
   }

http://doc.silverstripe.org/tabset

Avatar
Graphicator

Community Member, 62 Posts

1 August 2010 at 10:16pm

Thank you for this fresh information.

I ran into a website error whenever I added more than four 2nd-level tabs in the CMS. This solution was a breeze.

Attached Files