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

new tab on tab in system

Go to End

29 Posts   6746 Views


30 December 2008 at 11:27am Community Member, 131 Posts

Hi all,

I'm trying to make a new tabset on the maintab in the system, so that I can add fields to this new Root.Content.Main.Newtab-tab.
Right now I have this:

public static $db = array('Newtab' => 'TabSet');

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new Tab('Newtab','Newtab',array('Tab one','Tab two',));

return $fields; }

But that doesn't work. Does someone have a suggestion?

Carbon Crayon

30 December 2008 at 12:46pm Community Member, 598 Posts

Um, I don't think you can add a third level of tabs.....although I've never tried.

Is there a particular reason you cant just add it to the end of the second level of tabs?


30 December 2008 at 1:12pm Community Member, 131 Posts

Thanks for your reply. Of course I can add it to the end of the other tabs.
But I guess my users would more likely look top-down instead of left-right.
Left-right seems to be for the more advanced features (f.e. metadata - most of my users don't even know what these are, but I don't want to remove them completely).
Top-down would in that case be for the regular user.

By adding tabs on the main tab, I can force them to not overlook some fields (that are essential, but too much to add in a normal way in the main-tab)

Wow... that's quite a story. I hope you "can make chocolate out of it" (a weird dutch expression ;-) )

Carbon Crayon

30 December 2008 at 2:42pm Community Member, 598 Posts

hmm, I see. Well unfortunately i don't think I can help you as I've never seen this done.

perhaps one of the more experienced devs knows if it's possible?


30 December 2008 at 5:40pm (Last edited: 30 December 2008 5:41pm), 4085 Posts

I'm having a really hard time understanding what you're trying to do. Instad of this:

Content Behaviour ToDo
....Main MetaData etc
........MyTab1 MyTab2

You want this?

Content Behaviour ToDo
....Main MetaData etc

Where MyTab1 and MyTab2 would show/hide different fieldsets?


31 December 2008 at 9:08am (Last edited: 31 December 2008 9:18am), Community Member, 131 Posts

Euh... now I'm having a hard time...

What I'm aiming at is:

Content is the ancestor of main
Main is the ancestor of a tabset with 2 or 3 sibling-tabs (MyTab1, MyTab2 etc)

I guess that's the first option you wrote.

The second one would be:
Content is the ancestor of main
Main is the ancestor of MyTab1
MyTab1 is the ancestor of MyTab2

And that's not what I want.

Oh! Wait! I guess I understand your hard time!
Forget my second post. I'll try to make myself clear: There is some eyetracking research out on the web that discovered people are reading text's in an F-shape; the horizontals of the F being headings and so on (as long as they understand what they are reading), the verticals of the F being the first word of every plaintext-line, and of everything they don't understand. A link: [url][/url]

I expect my backend-users to start reading the form at "Page name" and getting bored if the form appears to long.
That means a few things:
1) they would miss everything on the horizontal line of Main, Metadata etc (not only because they simply won't see it, but also because they don't understand what metadata (the second-term) are).
2) I have some formitems like startdate, starttime, enddate, endtime, contactname, contactemail, eventlocation etc. While SS is ordering formfields below eachother, it would make a pretty long form (too long for my users). So I thought about grouping them on a few tabs (a date-tab, a contact-tab etc.) It would reduce the formlength considerably, and if I order that tabset just below Navigation label (for example), it would work as a new (horizontal) 'heading' in the F-shape.
I hope this helps ;-)
(BTW: the possibility to order the shorter date- and time-fields next to each other would be a neat feature)


31 December 2008 at 9:44am 4085 Posts

Easy enough. I'll whip up something for you when I get out of work. Give me a few hours.

I definitely agree with you about the F patterns, but I think that's why SS puts all the stuff you never use far to the right. :-)


31 December 2008 at 4:17pm 4085 Posts

This ought to get you started. Drop this folder in your Silverstripe root and run a flush.


      $fields->addFieldToTab("Root.Content.Main", new VerticalTabSet(
         new VerticalTab('Fruits', array (
            new TextField('Apple'),
            new TextField('Orange')
         new VerticalTab('Vegetables', array (
            new TextField('Carrot'),
            new TextField('Celery')

Let me know how that works for you.

Attached Files
Go to Top