From 1e194854e033f33db625c81146899a296b9b95fd Mon Sep 17 00:00:00 2001 From: Rodney Way Date: Tue, 10 Jun 2014 14:26:08 +1000 Subject: [PATCH] BUG: Ensure that all child pages are deleted (regardless of ShowInMenu status) under enforce_strict_hierarchy. Also updated SiteTree YML test data to match. --- code/model/SiteTree.php | 2 +- tests/model/SiteTreeTest.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index c61194c4..02c4f0c2 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1562,7 +1562,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid parent::onBeforeDelete(); // If deleting this page, delete all its children. - if(SiteTree::config()->enforce_strict_hierarchy && $children = $this->Children()) { + if(SiteTree::config()->enforce_strict_hierarchy && $children = $this->AllChildren()) { foreach($children as $child) { $child->delete(); } diff --git a/tests/model/SiteTreeTest.yml b/tests/model/SiteTreeTest.yml index 2f0cf282..e032d3ec 100644 --- a/tests/model/SiteTreeTest.yml +++ b/tests/model/SiteTreeTest.yml @@ -56,6 +56,7 @@ Page: Title: Staff URLSegment: my-staff Parent: =>Page.about + ShowInMenus: 0 products: Title: Products CanEditType: OnlyTheseUsers