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

Add a space in tab name


6 Posts   1493 Views

Big Bang Creative

18 March 2009 at 11:11pm Community Member, 92 Posts

How do I add a space into the tab name? I have created a tabset and added some more tabs as below but I could really do with there been spaces in the tab names (parent & child).


class HomePage extends Page {
static $db = array(
'Box1Thumbnail' => 'HTMLText',
'Box1Link' => 'HTMLText',
'Box2Thumbnail' => 'HTMLText',
'Box2Link' => 'HTMLText',
'Box3Thumbnail' => 'HTMLText',
'Box3Link' => 'HTMLText',
'Box4Thumbnail' => 'HTMLText',
'Box4Link' => 'HTMLText'
static $has_one = array(

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root', new TabSet('HomePageBoxes'));
$fields->addFieldToTab('Root.HomePageBoxes.Box1', new HTMLEditorField('Box1Thumbnail', 'Thumbnail'));
$fields->addFieldToTab('Root.HomePageBoxes.Box1', new HTMLEditorField('Box1Link', 'Link'));
$fields->addFieldToTab('Root.HomePageBoxes.Box2', new HTMLEditorField('Box2Thumbnail', 'Thumbnail'));
$fields->addFieldToTab('Root.HomePageBoxes.Box2', new HTMLEditorField('Box2Link', 'Link'));
$fields->addFieldToTab('Root.HomePageBoxes.Box3', new HTMLEditorField('Box3Thumbnail', 'Thumbnail'));
$fields->addFieldToTab('Root.HomePageBoxes.Box3', new HTMLEditorField('Box3Link', 'Link'));
$fields->addFieldToTab('Root.HomePageBoxes.Box4', new HTMLEditorField('Box4Thumbnail', 'Thumbnail'));
$fields->addFieldToTab('Root.HomePageBoxes.Box4', new HTMLEditorField('Box4Link', 'Link'));

return $fields;
class HomePage_Controller extends Page_Controller {


19 March 2009 at 2:17pm Community Member, 215 Posts

I take it you have tried just adding spaces? If that doesn't work then try it with double commas " not ' around the title.

   $fields->addFieldToTab("Root.Home Page Boxes.Box1", new HTMLEditorField('Box1Thumbnail', 'Thumbnail'));

Any joy?

Big Bang Creative

20 March 2009 at 3:59am Community Member, 92 Posts

Yes I did try it with spaces lol and it did not work


22 March 2009 at 5:03am (Last edited: 22 March 2009 5:05am), Forum Moderator, 1091 Posts

When I do this in my ContactForm page:

$fields->addFieldToTab('Root.Content.ContactForm', new TextField('Name', 'Name'));

the tab name will read 'Contact Form'. Tried this with other names as well - seems a space is added by using capitals (v2.3) Won't work with numbers I guess...

Big Bang Creative

10 April 2009 at 2:36am Community Member, 92 Posts

Your adding to "Content" which will put the text field under the content box which works fine. I am adding fields to a new tab which I still cannot get spaces in.


10 April 2009 at 2:52am Community Member, 901 Posts

TabSet takes a second parameter upon construction that will be used as Title (if it's a string).

So, you could do the following:

$fields->addFieldToTab('Root', new TabSet('HPBoxes', 'Home Page Boxes'));
$fields->addFieldToTab('Root.HPBoxes.Box1', new HTMLEditorField('Box1Thumbnail', 'Thumbnail'));