Permalink
Browse files

BUG Remove page types from the "add new page here" menu if they appea…

…r in a hide_ancestor (fixes #7712)
  • Loading branch information...
1 parent fe7c44d commit a2d76c93052ca4243ccff48bd3ebe893418287b8 @UndefinedOffset UndefinedOffset committed with wilr Sep 14, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 code/controllers/CMSMain.php
@@ -341,7 +341,7 @@ public function Breadcrumbs($unlinked = false) {
public function SiteTreeHints() {
$json = '';
- $classes = ClassInfo::subclassesFor( $this->stat('tree_class') );
+ $classes = SiteTree::page_type_classes();
$cacheCanCreate = array();
foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate();
@@ -373,7 +373,7 @@ public function SiteTreeHints() {
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
if($instance->stat('need_permission') && !$this->can(singleton($class)->stat('need_permission'))) continue;

0 comments on commit a2d76c9

Please sign in to comment.