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:
Sean Harvey 2009-02-03 20:34:13 +00:00
parent fea613c19f
commit 06a007f394

View File

@ -210,12 +210,17 @@ abstract class ModelAdmin extends LeftAndMain {
*/
function getManagedModels() {
$models = $this->stat('managed_models');
if(is_string($models)) $models = array($models);
if(!count($models)) user_error('ModelAdmin::getManagedModels():
if(is_string($models)) {
$models = array($models);
}
if(!count($models)) {
user_error(
'ModelAdmin::getManagedModels():
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"',
E_USER_ERROR
);
}
return $models;
}
@ -344,8 +349,7 @@ class ModelAdmin_CollectionController extends Controller {
if($this->hasMethod('alternatePermissionCheck')) {
if(!$this->alternatePermissionCheck()) return false;
}
else {
} else {
if(!singleton($modelName)->canCreate(Member::currentUser())) return false;
}
@ -354,6 +358,7 @@ class ModelAdmin_CollectionController extends Controller {
$actions = new FieldSet(
$createButton = new FormAction('add', $buttonLabel)
);
$createButton->dontEscape = true;
return new Form($this, "CreateForm", new FieldSet(), $actions);