mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
BUGFIX Consistently returning a record from VirtualPage->CopyContentFrom(), even if pointing to a non-existant ID (AIR-77)
This commit is contained in:
parent
5d235fa9f7
commit
21d10ad32f
@ -65,6 +65,9 @@ class VirtualPage extends Page {
|
|||||||
return $virtualFields;
|
return $virtualFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SiteTree Returns the linked page, or failing that, a new object.
|
||||||
|
*/
|
||||||
function CopyContentFrom() {
|
function CopyContentFrom() {
|
||||||
if(empty($this->record['CopyContentFromID'])) return new SiteTree();
|
if(empty($this->record['CopyContentFromID'])) return new SiteTree();
|
||||||
|
|
||||||
@ -83,7 +86,7 @@ class VirtualPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->components['CopyContentFrom'];
|
return $this->components['CopyContentFrom'] ? $this->components['CopyContentFrom'] : new SiteTree();
|
||||||
}
|
}
|
||||||
function setCopyContentFromID($val) {
|
function setCopyContentFromID($val) {
|
||||||
if(DataObject::get_by_id('SiteTree', $val) instanceof VirtualPage) $val = 0;
|
if(DataObject::get_by_id('SiteTree', $val) instanceof VirtualPage) $val = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user