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

Two possible bugs regarding custom CMS fields and Translatable?


Reply


359 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