class MyPage extends Page { private static $db = [ 'MyField' => 'Varchar(255)' ]; public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TextField::create('MyField', 'My field')); return $fields; } }
class MyPage extends Page { public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Content'); $fields->addFieldToTab('Root.Main', HtmlEditorField::create('Content', 'My content')); return $fields; } }In this example, we customize the "Content" field in the CMS by removing it and adding it back as an HTML editor field. We also change the label to "My content". Package/library: SilverStripe CMS Overall, the getCMSFields method is a powerful tool for developers using SilverStripe CMS. It allows for easy customization of the fields available in the CMS, and enables developers to create custom fields for their pages.