mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
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
This commit is contained in:
parent
6afd96eba4
commit
f2bf599795
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user