Extending SilverStripe 3 Site Settings

When you first install your SilverStripe site, the ‘Settings’ menu is pretty limited, offering just Title, Tagline, and a choice of templates.

This is fine, but it’s often useful to add other options, such as logo upload, links to facebook, uploading a banner image that appears on every page.


In your ‘mysite/code/’ folder, create a new file called ‘MySiteConfig.php’, and insert the following text:

This file creates a ‘DataExtension’. A┬áDataExtension, as the name suggests, is used to extend any set of data. You declare the additional databse fields and relations just as you would when creating a new page.

And you use the function ‘public function updateCMSFields {}’ to add the fields to the CMS page, just as you would when creating a new page.


In your ‘mysite’ folder, open the ‘_config,php’ file, and add the following line:

This line simple tells SilverStripe to take the ‘SiteConfig’ (the basic settings that already exist) and add ‘MySiteConfig’ to it.


Go to your site, log in, and add ‘/dev/build’ to the URL – eg ‘mysite.com/dev/build’ to refresh the database.

Now, in the admin area, go to the site settings page and you should see your new options.

Using these fields in the Template

You can now add a logo, banner image, and enter the facebook / vimeo links – the data is stored in the database, but we need to show it on our page.

We do this by adding ‘$SiteConfig.’ in front of the names of the fields. Eg:

, ,

3 Responses to “Extending SilverStripe 3 Site Settings”

  1. Valentijn December 1, 2014 at 4:15 pm # Reply

    Thank you very much for the code. unfortunately the header images don’t scale on smaller screen sizes.

    any suggestions where to find tis error?

  2. Mike September 20, 2014 at 1:56 am # Reply

    Ah, if it only worked…

    I’m getting the following error message:

    Fatal error: Object::add_extension() – Can’t find extension class for “MySiteConfig”

    Deprecated for SS 3.1.6 perhaps?

    • Clone December 4, 2014 at 9:44 pm # Reply

      I have just tested it with SS 3.1.5, works like a charm.

Leave a Reply