mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02: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 SiteTree Returns the linked page, or failing that, a new object.
|
||||
*/
|
||||
function CopyContentFrom() {
|
||||
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) {
|
||||
if(DataObject::get_by_id('SiteTree', $val) instanceof VirtualPage) $val = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user