I want to add a Field to the existing Tab "Settings" of Edit Page View (marked in the screenshot).
I tried this:
$fields->addFieldToTab('Root.Settings', new TextField('Intro'));
But it just adds a new tab next to the secondary Tab "Main Content" containing the additional Field.
For SilverStripe 3.0 you need to override the getSettingsFields() function in your Model e.g.
function getSettingsFields() {
$fields = parent::getSettingsFields();
$fields->addFieldToTab("Root.Settings", new TextField('Intro'));
return $fields;
}
In SilverStripe 2.x this is done in the getCMSFields() function.
This method worked for me:
public function updateSettingsFields(FieldList $fields) {
$fields->addFieldToTab("Root.MyNewSettingsSubTab", new TextField('Intro'));
return $fields;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With