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, Ed, biapar, Willr, Ingo, swaiba

Changing tabs name but not the variable in templates

Go to End

3 Posts   1880 Views


Community Member, 211 Posts

23 September 2010 at 2:46am


To add a tab in the cms I usually do somethin like this :

class EditorialPage extends Page {
   static $db = array(
		'Phrase' => 'HTMLText',



public function getCMSFields() {
		$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Phrase', new HtmlEditorField('Phrase'));

and the variable in my template is $Phrase

Now to change the name of the tab in the cms but not the variable name do I have to writte it like this :

$fields->addFieldToTab('Root.Content.AnotherName', new HtmlEditorField('Phrase')); ?

Thank you



Community Member, 470 Posts

23 September 2010 at 7:13am

Yes, you change the line Root.Content.AnotherName to whatever you want. If you change 'content' to another tab that is in the CMS, it will show up under that tab.

If you want to change the label of the filed, use this:

$fields->addFieldToTab('Root.Content.AnotherName', new HtmlEditorField('Phrase', 'Whatever You Want The Label To Be'));


Community Member, 63 Posts

10 November 2011 at 12:00am

Will this screw up the existing data in the database or will it just change keeping everything as is and just change the tab name? I know this is an old thread but someone may know. Cheers....