mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Added CurrentSubsite in at ControllerSubsites decorator
This commit is contained in:
parent
e70fa8f2e7
commit
4957e69a03
@ -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');
|
||||
|
||||
|
18
code/ControllerSubsites.php
Normal file
18
code/ControllerSubsites.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user