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

Two possible bugs regarding custom CMS fields and Translatable?


Go to End


673 Views

Avatar
smares

Community Member, 25 Posts

14 October 2011 at 2:44am

Assuming I want to remove the MenuTitle field in CMS from all pages and return Title instead, I modify Page.php by overwriting getCMSFields()

public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('MenuTitle');
return $fields;
}

and adding getMenuTitle:

public function getMenuTitle() {
return $this->Title;
}

This works fine when viewing the page in the default locale, but when switching to a localized version of the page, the text field for MenuTitle is gone, but the original value in English is still displayed. See the first screenshot.

The second problem is when adding elements before other ones. addFieldToTab accepts as third parameter the name of the field to insert before. Again, in English everything appears OK, but in localized versions of the page, the fields are nested incorrectly because of the original version that appears below the input field. See the second screenshot.

Attached Files