MINOR phpDoc for CMSMain->PageTypes()

MINOR Code syntax formatting for CMSMain->PageTypes()
MINOR Removed commented out code in CMSMain->PageTypes()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64395 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-10-16 09:37:28 +00:00
parent 86b81b81f5
commit 1acd10f35a

View File

@ -262,8 +262,10 @@ JS;
}
/**
* Populates an array of classes in the CMS which allows the
* user to change the page type.
* Populates an array of classes in the CMS
* which allows the user to change the page type.
*
* @return DataObjectSet
*/
public function PageTypes() {
$classes = ClassInfo::getValidSubClasses();
@ -293,6 +295,7 @@ JS;
foreach($classes as $class) {
$instance = singleton($class);
if($instance instanceof HiddenClass) continue;
if(!$instance->canCreate()) continue;
@ -300,24 +303,14 @@ JS;
// skip this type if it is restricted
if($instance->stat('need_permission') && !$this->can(singleton($class)->stat('need_permission'))) continue;
/*
* Since i18n_singular_name() this is not necessary
$addAction = $instance->uninherited('add_action', true);
if($addAction) {
// backwards compatibility for actions like "a page" (instead of "page")
$addAction = preg_replace('/^a /','',$addAction);
$addAction = ucfirst($addAction);
} else {
$addAction = $instance->i18n_singular_name();
}
*/
$addAction = $instance->i18n_singular_name();
$result->push(new ArrayData(array(
"ClassName" => $class,
"AddAction" => $addAction,
'ClassName' => $class,
'AddAction' => $addAction,
)));
}
$result->sort('AddAction');
return $result;