From 42f55daeef039f78125a47c5dca1e9713182c947 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Thu, 21 Aug 2008 23:31:28 +0000 Subject: [PATCH] --- code/SiteTreeSubsites.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/SiteTreeSubsites.php b/code/SiteTreeSubsites.php index 9f8510e..1136d2a 100644 --- a/code/SiteTreeSubsites.php +++ b/code/SiteTreeSubsites.php @@ -61,11 +61,21 @@ class SiteTreeSubsites extends DataObjectDecorator { } } + /** + * Call this method before writing; the next write carried out by the system won't + * set the CustomContent value + */ + function nextWriteDoesntCustomise() { + $this->nextWriteDoesntCustomise = true; + } + + protected $nextWriteDoesntCustomise = false; + function augmentBeforeWrite() { if(!is_numeric($this->owner->ID) && !$this->owner->SubsiteID) $this->owner->SubsiteID = Subsite::currentSubsiteID(); // If the content has been changed, then the page should be marked as 'custom content' - if($this->owner->ID && $this->owner->MasterPageID && !$this->owner->CustomContent) { + if(!$this->nextWriteDoesntCustomise && $this->owner->ID && $this->owner->MasterPageID && !$this->owner->CustomContent) { $changed = $this->owner->getChangedFields(); foreach(self::$template_fields as $field) { @@ -76,6 +86,8 @@ class SiteTreeSubsites extends DataObjectDecorator { } } } + + $this->nextWriteDoesntCustomise = false; } function updateCMSFields(&$fields) {