mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-06-28 15:39:31 +02:00
BUGFIX: A page type with requireDefaultRecords(), for instance ErrorPage, was created everytime on the main site when dev/build-ing (with subdomain in the url) and there's no that page type in the subsite's sitetree.
This commit is contained in:
parent
221599c776
commit
0b3b4b555c
|
@ -86,7 +86,10 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||||
protected $nextWriteDoesntCustomise = false;
|
protected $nextWriteDoesntCustomise = false;
|
||||||
|
|
||||||
function augmentBeforeWrite() {
|
function augmentBeforeWrite() {
|
||||||
if(!is_numeric($this->owner->ID) && !$this->owner->SubsiteID) $this->owner->SubsiteID = Subsite::currentSubsiteID();
|
// if the page hasn't been written to a database table yet and no subsite has been set, then give it a subsite
|
||||||
|
if((!is_numeric($this->owner->ID) || $this->owner->ID == 0) && !$this->owner->SubsiteID) {
|
||||||
|
$this->owner->SubsiteID = Subsite::currentSubsiteID();
|
||||||
|
}
|
||||||
|
|
||||||
// If the content has been changed, then the page should be marked as 'custom content'
|
// 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) {
|
if(!$this->nextWriteDoesntCustomise && $this->owner->ID && $this->owner->MasterPageID && !$this->owner->CustomContent) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user