5121 Posts in 1527 Topics by 1119 members
| Go to End | Next > | |
| Author | Topic: | 2465 Views |
-
renameField has no effect

8 May 2009 at 1:14pm
As far as I can tell I'm using it correctly, but it doesn't do anything.
eg:
class CoursePage extends Page {
...function getCMSFields() {
$fields = parent::getCMSFields();
$fields->renameField('Content', 'Other');
return $fields;
}}
My 'Content' tab should now have the label 'Other', correct?
-
Re: renameField has no effect

8 May 2009 at 4:03pm
Okay maybe it is working, but I still don't understand how to use it.
The code posted above will change the label above the TinyMCE editor.
What I want to do is rename a tab.
Is it correct that I should just need to call $fields->renameField('Root.Content.Main', 'Root.Content.OtherName'); ?
Is it even possible to rename tabs?
Have I got the names wrong? Please help!
-
Re: renameField has no effect

4 April 2010 at 2:37am
I guess that it's a no for being able to rename tabs then?
-
Re: renameField has no effect

4 April 2010 at 2:57am
Ok, I figured it out. In ModelAdmin the code to rename 'Main' tab is:
$main = $fields->fieldByName('Root')->fieldByName('Main');
$main->setTitle('Other');In Pages it would probably be something like:
$main = $fields->fieldByName('Root')->fieldByName('Content')->fieldByName('Main');
$main->setTitle('Other'); -
Re: renameField has no effect

10 July 2010 at 11:22pm
Thanks timwjohn! You saved me alot of hassle
Your Code works perfect.
-
Re: renameField has no effect

12 July 2010 at 11:35pm
$fields->fieldByName('Root.Content.Main')->setTitle('Other');
Save yourself a bit of typing
| 2465 Views | ||
| Go to Top | Next > |



