mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
API CHANGE Removed unused nextWriteDoesntCustomise flag on SiteTreeSubsites, removed references to non-existent CustomContent field in SiteTreeSubsites->onBeforeWrite() (field was removed with 08207510c in 2008) (AIR-52)
This commit is contained in:
parent
bb486548d6
commit
47c545f658
@ -81,33 +81,8 @@ class SiteTreeSubsites extends SiteTreeDecorator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 onBeforeWrite() {
|
function onBeforeWrite() {
|
||||||
if(!$this->owner->ID && !$this->owner->SubsiteID) $this->owner->SubsiteID = Subsite::currentSubsiteID();
|
if(!$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->nextWriteDoesntCustomise && $this->owner->ID && $this->owner->MasterPageID && !$this->owner->CustomContent) {
|
|
||||||
$changed = $this->owner->getChangedFields();
|
|
||||||
|
|
||||||
foreach(self::$template_fields as $field) {
|
|
||||||
if(isset($changed[$field]) && $changed[$field]) {
|
|
||||||
$this->owner->CustomContent = true;
|
|
||||||
FormResponse::add("if($('Form_EditForm_CustomContent')) $('Form_EditForm_CustomContent').checked = true;");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->nextWriteDoesntCustomise = false;
|
|
||||||
|
|
||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,7 @@ class SubsitesVirtualPage extends VirtualPage {
|
|||||||
class SubsitesVirtualPage_Controller extends VirtualPage_Controller {
|
class SubsitesVirtualPage_Controller extends VirtualPage_Controller {
|
||||||
|
|
||||||
function reloadContent() {
|
function reloadContent() {
|
||||||
$this->failover->nextWriteDoesntCustomise();
|
|
||||||
$this->failover->copyFrom($this->failover->CopyContentFrom());
|
$this->failover->copyFrom($this->failover->CopyContentFrom());
|
||||||
$this->failover->nextWriteDoesntCustomise();
|
|
||||||
$this->failover->write();
|
$this->failover->write();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user