mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
MINOR Code formatting tidy up in ModelAdmin
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@71302 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fea613c19f
commit
06a007f394
@ -210,12 +210,17 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
*/
|
*/
|
||||||
function getManagedModels() {
|
function getManagedModels() {
|
||||||
$models = $this->stat('managed_models');
|
$models = $this->stat('managed_models');
|
||||||
if(is_string($models)) $models = array($models);
|
if(is_string($models)) {
|
||||||
if(!count($models)) user_error('ModelAdmin::getManagedModels():
|
$models = array($models);
|
||||||
|
}
|
||||||
|
if(!count($models)) {
|
||||||
|
user_error(
|
||||||
|
'ModelAdmin::getManagedModels():
|
||||||
You need to specify at least one DataObject subclass in protected static $managed_models.
|
You need to specify at least one DataObject subclass in protected static $managed_models.
|
||||||
Make sure the visibility of your property is set to "protected"',
|
Make sure the visibility of your property is set to "protected"',
|
||||||
E_USER_ERROR
|
E_USER_ERROR
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $models;
|
return $models;
|
||||||
}
|
}
|
||||||
@ -344,8 +349,7 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
|
|
||||||
if($this->hasMethod('alternatePermissionCheck')) {
|
if($this->hasMethod('alternatePermissionCheck')) {
|
||||||
if(!$this->alternatePermissionCheck()) return false;
|
if(!$this->alternatePermissionCheck()) return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if(!singleton($modelName)->canCreate(Member::currentUser())) return false;
|
if(!singleton($modelName)->canCreate(Member::currentUser())) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +358,7 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
$actions = new FieldSet(
|
$actions = new FieldSet(
|
||||||
$createButton = new FormAction('add', $buttonLabel)
|
$createButton = new FormAction('add', $buttonLabel)
|
||||||
);
|
);
|
||||||
|
|
||||||
$createButton->dontEscape = true;
|
$createButton->dontEscape = true;
|
||||||
|
|
||||||
return new Form($this, "CreateForm", new FieldSet(), $actions);
|
return new Form($this, "CreateForm", new FieldSet(), $actions);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user