From 4957e69a0354cb9e394dec6376c034a982659b1a Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Thu, 19 Jun 2008 00:46:51 +0000 Subject: [PATCH] Added CurrentSubsite in at ControllerSubsites decorator --- _config.php | 3 ++- code/ControllerSubsites.php | 18 ++++++++++++++++++ code/Subsite.php | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 code/ControllerSubsites.php diff --git a/_config.php b/_config.php index eee62f4..a0212a4 100644 --- a/_config.php +++ b/_config.php @@ -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'); diff --git a/code/ControllerSubsites.php b/code/ControllerSubsites.php new file mode 100644 index 0000000..6e52518 --- /dev/null +++ b/code/ControllerSubsites.php @@ -0,0 +1,18 @@ +Theme) + SSViewer::set_theme($theme); + } + } + + function CurrentSubsite(){ + if($subsite = Subsite::currentSubsite()){ + return $subsite; + } + } +} + +?> \ No newline at end of file diff --git a/code/Subsite.php b/code/Subsite.php index 90c60f0..59bab5d 100644 --- a/code/Subsite.php +++ b/code/Subsite.php @@ -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; }