mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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:
parent
fe7c44d7d4
commit
a2d76c9305
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user