SSbits - Home page
Site by Carbon Crayon
Submit a Post >

Snippets - Little bits of code to make you happy

Remove theme selector from SiteConfig

2.4 has introduced the SiteConfig, which by default allows the user to switch themes - if they exist.

It's incredibly useful to have this functionality built-in now, but for those that only have one theme for a site, it's a bit of unnecessary clutter. Here is how to remove it by using a decorator

class CustomSiteConfig extends DataObjectDecorator {
	function updateCMSFields(FieldSet &$fields) {

Then simply apply your decorator from the _config.php file:

DataObject::add_extension('SiteConfig', 'CustomSiteConfig');

For more info on SiteConfig, see this post: Working with SiteConfig

Daniel Hensby avatar

Daniel Hensby

Dan runs a website development company called Better Brief. Better Brief specialise in SilverStripe websites and takes an active role in the UK SilverStripe community, attending SS Meetups and even presenting at them.

  • Chris Hope
    15/10/2010 2:14am (7 years ago)

    Funnily enough I'd done exactly this myself on one of my sites about half an hour before you posted it. If you want to get rid of the other ones too, because you don't use them anywhere:


  • Marcus Dalgren
    15/10/2010 8:16am (7 years ago)

    Yes removing the theme selector makes alot of sense in most cases. SiteConfig is also a great place to put global information about the site so that you don't clutter up your homepage.

  • Jeroen Marechal
    20/10/2010 10:23pm (7 years ago)

    Yes, I think the theme selection is a bit unnecessary. Never actually used it eithe. Better of using the space for some global information

  • MRKDevelopment
    21/11/2010 11:23am (7 years ago)

    Its only useful when doing multi site setups.

    This is a great tip though, customer generally will break anything if you give them access too.

  • Darren-Lee
    09/04/2011 1:07pm (6 years ago)

    Thanks, Dan. Since reading your post, I use this all the time - it helps to clean up the admin interface - one less thing for the client to get confused about!

  • gav
    04/07/2012 7:55am (5 years ago)

    This is the SilverStripe 3 version of this:

    Object::add_extension('SiteConfig', 'SiteConfigDecorator');


    class SiteConfigDecorator extends DataExtension {

    static $db = array();

    public function updateCMSFields(FieldList $fields) {

    function __construct() {


Post a comment ...

You cannot post comments until you have logged in. Login Here.


Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image wfacewomens
3 article image Daniel Hensby
4 article image Marcus Dalgren
5 article image ryduhartchas
6 article image Hamish Campbell
7 article image Ty Barho
8 article image Martijn van Nieuwenhoven
9 article image Darren-Lee
10 article image Roman Schmid

View full leaderboard