From f2bf599795870080c2818afb85a3d8ed3b93e868 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 4 Nov 2008 01:32:45 +0000 Subject: [PATCH] BUGFIX Calling parent constructor on ModelAdmin classes so $this->class gets set properly and doesn't confuse the RequestHandler BUGFIX Add magic methods on ModelAdmin to $allowed_actions (regression from r64988) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65180 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ModelAdmin.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index dd862d91..2004914e 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -38,6 +38,9 @@ abstract class ModelAdmin extends LeftAndMain { */ protected static $managed_models = null; + /** + * More actions are dynamically added in {@link defineMethods()} below. + */ public static $allowed_actions = array( 'add', 'edit', @@ -138,6 +141,7 @@ abstract class ModelAdmin extends LeftAndMain { parent::defineMethods(); foreach($this->getManagedModels() as $ClassName) { $this->addWrapperMethod($ClassName, 'bindModelController'); + self::$allowed_actions[] = $ClassName; } } @@ -364,6 +368,8 @@ class ModelAdmin_CollectionController extends Controller { function __construct($parent, $model) { $this->parentController = $parent; $this->modelClass = $model; + + parent::__construct(); } /** @@ -436,6 +442,7 @@ class ModelAdmin_CollectionController extends Controller { $form->setHTMLID("Form_SearchForm_" . $this->modelClass); $clearAction->useButtonTag = true; $clearAction->addExtraClass('minorAction'); + return $form; } @@ -670,6 +677,8 @@ class ModelAdmin_RecordController extends Controller { $modelName = $parentController->getModelClass(); $recordID = $request->param('Action'); $this->currentRecord = DataObject::get_by_id($modelName, $recordID); + + parent::__construct(); } /**