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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

new tab on tab in system

Go to End

29 Posts   8599 Views


Community Member, 131 Posts

1 January 2009 at 4:54am


I'm impressed! I don't think I could come up with that (yet).
At least it seams I really was thinking to easy about it.

Thanks alot for all your hard work!

Right now I'm trying to get it working.
The 'Hi' alert from the js is showing already (even twice), so that's a good thing I guess.
However the vertical tabs aren't there yet.

I've added the unpacked zip to localhost/silverstripe/
The example usage-code went into function getCMSFields() {}
And I added Text-columns for Apple, Orange, Carrot and Celery to the database (public static $db = array() )

I tried adding tab and/or tabset-columns to the db, but that gave errors while flushing.

Do I forget something?

Update: I removed the line (4) with alert('hi'); from the js-file, but (even after flushing and refreshing) I get the hi-alert twice ^o|


Forum Moderator, 4102 Posts

1 January 2009 at 5:38am

Can you post your entire PHP class for the page you're working on?

Haha.. sorry about the alert('hi').. gotta love debugging.


Forum Moderator, 4102 Posts

1 January 2009 at 5:40am

Sorry, I just missed your last point about adding columns to the DB. That is not how it's used. This is just for the visual presentation -- not the actual data. The tabs and tabsets are NOT data types. They're form fields.


Community Member, 131 Posts

1 January 2009 at 5:55am

Thanks for you're reply's. I'll dig further into it tomorrow (or the day after).
Right now I'm heading for some newyears eve-parties (though the forum says it's already jan 1st, here in europe it's still 31 december)

Best wishes to you and all other SilverStripers and be save


Community Member, 131 Posts

2 January 2009 at 11:05am

Edited: 02/01/2009 12:12pm

Hi again,

Back again, and it's 2009!

On topic: While doing it, I wasn't sure at all about adding tab or tabset to the db. It was more or less an experiment, just in case I was missing something - well, I wasn't, because it didn't work (and you said so too). Or were you also talking about adding the apple, orange etc. to db? That would make everything a little more complex to me. They are meant to populate the db, aren't they (just like in the tutorials: $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content'); and $db = array('Author' => 'Text'); in a way belong together)

Below is the whole class (basically a copy-paste of your class), and in the attachment a screenshot of what is showing up (just before I clicked the hi-alert away - I kind of love those debugging things too, so I left it in for now ;) ).

 * Defines the PageTest page type
class PageTest extends Page {
	public static $db = array(
		'Apple' => 'Text',
		'Orange' => 'Text',
		'Carrot' => 'Text',
		'Celery' => 'Text',
	public static $has_one = array(
	function getCMSFields() {
		$fields = parent::getCMSFields();

		$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')
		return $fields;

class PageTest_Controller extends Page_Controller {

Might it be that I'm developing for the 2.3rc2?

Attached Files

Community Member, 131 Posts

2 January 2009 at 11:26am

Edited: 02/01/2009 12:13pm

It had something to do with both the vertical_tabset.js and the images not showing up.

As soon as I not only commented out line 4 (alert('hi'); in the .js-file but also the surrounding lines 3-6, there were (all of a sudden) the so much wanted fruit and vegetable-fields. Searching a little bit further learned me, they were always there, nicely hidden in their folded harmonica tabs. But because of a lack of images and headings on those tabs, I didn't see them.

Which means: I just have to dig a little further, bring up the images and the headings (that should be doable) and it's up and running! Seems to be a CSS-thing after all.


Update: Well... OK... not that much of a eureka. The (easy) CSS part is solved. But now I'm desperately searching for a way to connect the Formfields Apple, Orange etc. to their own db-columns... And that - of course - is why this all started. At least it isn't as easy as just filling the $db = array() anymore


Forum Moderator, 4102 Posts

2 January 2009 at 1:31pm

Glad it's working for you. You can style the h3 tags any way you like. I just chose to keep it consistent with the SS theme. The default state is open for the h3, but if you add the class "closed" it will render its closed state (arrow up).

I'd like to see any changes you add to it, then I'll post it on my website. Pretty cool idea. Thanks for thinking of it!


Community Member, 131 Posts

3 January 2009 at 5:25am

I will definitely post any changes.
In terms of layout I'm thinking about making everything a bit lighter and more blueish. The grey is very good if the vertical tabs are situated at the bottom, but imo that's a bit overdone if the vertical tabs are let's say just above $content. Maybe a little border around the tabs would also be a good idea...

But that's not what I'm concerned with right now. Because - in order to get it usefull to me and anyone else - the formfields in the tab(sets) should be able to save something to the database (because that's what the cms is for after all). I think I have to extend the Save and Publish page handler in LeftandMain.php (from line 428). Or maybe this discussion you and Aram started could be of some use. But to be honest, I stuck right now.