BUG Remove page types from the "add new page here" menu if they appear in a hide_ancestor (fixes #7712)

This commit is contained in:
UndefinedOffset 2012-09-14 16:03:40 -03:00 committed by Will Rossiter
parent fe7c44d7d4
commit a2d76c9305

View File

@ -341,7 +341,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function SiteTreeHints() { public function SiteTreeHints() {
$json = ''; $json = '';
$classes = ClassInfo::subclassesFor( $this->stat('tree_class') ); $classes = SiteTree::page_type_classes();
$cacheCanCreate = array(); $cacheCanCreate = array();
foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate(); foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate();
@ -373,7 +373,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
if($instance instanceof HiddenClass) continue; if($instance instanceof HiddenClass) continue;
if(!$cacheCanCreate[$child]) continue; if(!array_key_exists($child, $cacheCanCreate) || !$cacheCanCreate[$child]) continue;
// skip this type if it is restricted // skip this type if it is restricted
if($instance->stat('need_permission') && !$this->can(singleton($class)->stat('need_permission'))) continue; if($instance->stat('need_permission') && !$this->can(singleton($class)->stat('need_permission'))) continue;