mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX: Fix SubsiteVirtualPages not updating content. (from r84995)
This commit is contained in:
parent
c81319e23b
commit
ae2c8c094f
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Extension for the SiteTree object to add subsites support
|
||||
*/
|
||||
class SiteTreeSubsites extends DataObjectDecorator {
|
||||
class SiteTreeSubsites extends SiteTreeDecorator {
|
||||
static $template_variables = array(
|
||||
'((Company Name))' => 'Title'
|
||||
);
|
||||
@ -107,6 +107,32 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
|
||||
$this->nextWriteDoesntCustomise = false;
|
||||
}
|
||||
|
||||
function onAfterWrite(&$original) {
|
||||
// Update any subsite virtual pages that might need updating
|
||||
Subsite::$disable_subsite_filter = true;
|
||||
|
||||
$linkedPages = DataObject::get("SubsitesVirtualPage", "CopyContentFromID = {$this->owner->ID}");
|
||||
if($linkedPages) foreach($linkedPages as $page) {
|
||||
$page->copyFrom($page->CopyContentFrom());
|
||||
$page->write();
|
||||
}
|
||||
|
||||
Subsite::$disable_subsite_filter = false;
|
||||
}
|
||||
|
||||
function onAfterPublish(&$original) {
|
||||
// Publish any subsite virtual pages that might need publishing
|
||||
Subsite::$disable_subsite_filter = true;
|
||||
|
||||
$linkedPages = DataObject::get("SubsitesVirtualPage", "CopyContentFromID = {$this->owner->ID}");
|
||||
if($linkedPages) foreach($linkedPages as $page) {
|
||||
$page->copyFrom($page->CopyContentFrom());
|
||||
$page->doPublish();
|
||||
}
|
||||
|
||||
Subsite::$disable_subsite_filter = false;
|
||||
}
|
||||
|
||||
function updateCMSFields(&$fields) {
|
||||
if($this->owner->MasterPageID) {
|
||||
|
Loading…
Reference in New Issue
Block a user