Merge pull request #1027 from rodneyway/1026-SiteTree-page-delete-omits-children-with-ShowInMenus-off

Ensure that all child pages are deleted (regardless of their ShowInMenu ...
This commit is contained in:
Damian Mooyman 2014-06-24 19:41:39 +12:00
commit a1286f1c0f
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