From f97fc4ad65788da237ef6c96691c7708bf1e9cff Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 16 Aug 2007 06:27:32 +0000 Subject: [PATCH] Added ability for SiteTree extensions to define contentcontrollerInit() or modelascontrollerInit(), to add extra behaviour necessary for some modules (in particular, subsites) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40224 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/ContentController.php | 5 +++-- core/control/ModelAsController.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/control/ContentController.php b/core/control/ContentController.php index be44dba72..50f251d6c 100644 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -80,7 +80,7 @@ class ContentController extends Controller { public function init() { parent::init(); - + // If we've accessed the homepage as /home/, then we should redirect to /. if($this->dataRecord && RootURLController::should_be_on_root($this->dataRecord) && !$this->urlParams['Action'] && !$_POST && !$_FILES) { $getVars = $_GET; @@ -91,7 +91,8 @@ class ContentController extends Controller { die(); } - Versioned::choose_site_stage(); + singleton('SiteTree')->extend('contentcontrollerInit', $this); + Director::set_site_mode('site'); // Check permissions diff --git a/core/control/ModelAsController.php b/core/control/ModelAsController.php index eda49cd8a..54ebc49cd 100644 --- a/core/control/ModelAsController.php +++ b/core/control/ModelAsController.php @@ -13,7 +13,7 @@ class ModelAsController extends Controller implements NestedController { } public function init() { - Versioned::choose_site_stage(); + singleton('SiteTree')->extend('modelascontrollerInit', $this); } public function getNestedController() {