Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Add CMS user theme switcher

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 991 Views
  • spencer
    Avatar
    Community Member
    8 Posts

    Add CMS user theme switcher Link to this post

    Hello,

    I am trying to add the theme switcher in this post. http://www.silverstripe.org/customising-the-cms/show/252519 However, I am not sure where root.content.main is located I thought it would be in leftandmain.php but could not find it. any help would be greatly appreciated.

    <?php

    class Page extends SiteTree {
    static $db = array(
    'ThemeX' => "Enum('higherground,blackcandy','higherground')"
    );
    static $has_one = array(
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Main', new DropdownField(
    'ThemeX',
    'Select A Theme:',
    singleton('Page')->dbObject('ThemeX')->enumValues()
    ));

    return $fields;}
    }

    class Page_Controller extends ContentController {
    function init() {

    SSViewer::set_theme($this->ThemeX);

    parent::init();

    Requirements::themedCSS("layout");
    Requirements::themedCSS("typography");
    Requirements::themedCSS("form");
    }
    }

    ?>

    Thanks,

    Spencer

    991 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.