Skip to content

Commit

Permalink
BUG Remove page types from the "add new page here" menu if they appea…
Browse files Browse the repository at this point in the history
…r in a hide_ancestor (fixes #7712)
  • Loading branch information
UndefinedOffset authored and wilr committed Sep 15, 2012
1 parent fe7c44d commit a2d76c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/controllers/CMSMain.php
Expand Up @@ -341,7 +341,7 @@ public function Breadcrumbs($unlinked = false) {
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();
Expand Down Expand Up @@ -373,7 +373,7 @@ public function SiteTreeHints() {


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;
Expand Down

0 comments on commit a2d76c9

Please sign in to comment.