BUG: Ensure that all child pages are deleted (regardless of ShowInMenu status) under enforce_strict_hierarchy.

Also updated SiteTree YML test data to match.
This commit is contained in:
Rodney Way 2014-06-10 14:26:08 +10:00
parent 601efbc088
commit 1e194854e0
2 changed files with 2 additions and 1 deletions

View File

@ -1562,7 +1562,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
parent::onBeforeDelete(); parent::onBeforeDelete();
// If deleting this page, delete all its children. // 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) { foreach($children as $child) {
$child->delete(); $child->delete();
} }

View File

@ -56,6 +56,7 @@ Page:
Title: Staff Title: Staff
URLSegment: my-staff URLSegment: my-staff
Parent: =>Page.about Parent: =>Page.about
ShowInMenus: 0
products: products:
Title: Products Title: Products
CanEditType: OnlyTheseUsers CanEditType: OnlyTheseUsers