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.