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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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

Replace CMS field name and change field type


Go to End


2 Posts   3024 Views

Avatar
vxd

Community Member, 19 Posts

25 February 2013 at 3:52pm

I've searched the docs but couldn't find it.

I want to change the name of the CMS field "Content" to something else and also change the HtmlEditorField to a textField.

Thanks

Avatar
kinglozzer

Community Member, 187 Posts

25 February 2013 at 10:09pm

The easiest way to do it is in your Page class getCMSFields(), untested:

public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Content'); // Might be 'Root.Content' or 'Root.Main.Content', not sure which
$fields->insertAfter(new TextField('Content', 'Your Field Name'), 'MenuTitle');
return $fields;
}

'Content' has a data type of 'HTMLText', but I think you should be okay to save standard text input into it. Not sure how to change its datatype if not.