Added CurrentSubsite in at ControllerSubsites decorator

This commit is contained in:
Normann Lou 2008-06-19 00:46:51 +00:00
parent e70fa8f2e7
commit 4957e69a03
3 changed files with 25 additions and 1 deletions

View File

@ -8,8 +8,9 @@
Object::add_extension('SiteTree', 'SiteTreeSubsites');
// Hack - this ensures that the SiteTree defineMethods gets called before any of its subclasses...
new SiteTree();
Object::add_extension('ContentController', 'ControllerSubsites');
Object::add_extension('LeftAndMain', 'LeftAndMainSubsites');
Object::add_extension('LeftAndMain', 'ControllerSubsites');
Object::add_extension('Group', 'GroupSubsites');
Object::add_extension('File', 'FileSubsites');

View File

@ -0,0 +1,18 @@
<?php
class ControllerSubsites extends Extension {
function controllerAugmentInit(){
if($subsite = Subsite::currentSubsite()){
if($theme = $subsite->Theme)
SSViewer::set_theme($theme);
}
}
function CurrentSubsite(){
if($subsite = Subsite::currentSubsite()){
return $subsite;
}
}
}
?>

View File

@ -20,6 +20,9 @@ class Subsite extends DataObject implements PermissionProvider {
'IsPublic' => 'Boolean'
);
static $has_one = array(
);
static $indexes = array(
'Subdomain' => true,
'Domain' => true
@ -94,6 +97,8 @@ class Subsite extends DataObject implements PermissionProvider {
/* if($themes = SSViewer::getThemes(false))
$fields->addFieldsToTab('Root.Configuration', new DropdownField('Theme', 'Theme:', $themes, $this->Theme));
*/
$this->updateCMSFields($fields);
return $fields;
}