21487 Posts in 5783 Topics by 2621 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1206 Views |
-
Add a space in tab name

18 March 2009 at 11:11pm
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).
<?php
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 {
}
?> -
Re: Add a space in tab name

19 March 2009 at 2:17pm
I take it you have tried just adding spaces? If that doesn't work then try it with double commas " not ' around the title.
Like:
$fields->addFieldToTab("Root.Home Page Boxes.Box1", new HTMLEditorField('Box1Thumbnail', 'Thumbnail'));Any joy?
-
Re: Add a space in tab name

20 March 2009 at 3:59am
Yes I did try it with spaces lol and it did not work
-
Re: Add a space in tab name

22 March 2009 at 5:03am Last edited: 22 March 2009 5:05am
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...
-
Re: Add a space in tab name

10 April 2009 at 2:36am
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.
-
Re: Add a space in tab name

10 April 2009 at 2:52am
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'));
...
| 1206 Views | ||
|
Page:
1
|
Go to Top |


