Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Add CMS user theme switcher


Reply

1040 Views

Avatar
spencer

30 December 2009 at 7:09am Community Member, 8 Posts

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