mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR when a parent page is unpublished, unpublish all related virtual pages, includes test coverage (from r94777)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96771 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
31d194087c
commit
9e658e09e6
@ -1971,6 +1971,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
$this->Status = "Unpublished";
|
||||
$this->write();
|
||||
|
||||
// Unpublish all virtual pages that point here
|
||||
// This coupling to the subsites module is frustrating, but difficult to avoid.
|
||||
if(class_exists('Subsite')) {
|
||||
$virtualPages = Subsite::get_from_all_subsites('VirtualPage', "CopyContentFromID = {$this->ID}");
|
||||
} else {
|
||||
$virtualPages = DataObject::get('VirtualPage', "CopyContentFromID = {$this->ID}");
|
||||
}
|
||||
if ($virtualPages) foreach($virtualPages as $vp) $vp->doUnpublish();
|
||||
|
||||
$this->extend('onAfterUnpublish');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user