Add field to SilverStripe Settings Page

Silverstripe Version: 4.3.1

How can I add formfields to the SilverStripes CMS Settings Page (where you can edit page title and slogan)?
I searched on google but only found how to add custom fields to a Root.Settings of a page.
Do I need to create an extension for DataExtension to add custom fields on the Settings Page?

This is the code I use to add a textfield to the settings tab of a page.

namespace {

    use SilverStripe\CMS\Model\SiteTree;
    use SilverStripe\Forms\TextField;

    class Page extends SiteTree
    {
        private static $db = [
			'Intro' => 'Varchar',
		];

        private static $has_one = [];

        function getSettingsFields() {
			$fields = parent::getSettingsFields();
			$fields->addFieldToTab("Root.Settings", new TextField('Intro'));
			return $fields;
		}
    }
}

Thanks for the help.

You probably want to look at an extension to SiteConfig.

Take a look here: https://docs.silverstripe.org/en/4/developer_guides/configuration/siteconfig/#extending-siteconfig

That will hopefully give you what you need.

1 Like

That was exactly what I was looking for. Thank you!