diff --git a/code/model/VirtualPage.php b/code/model/VirtualPage.php index fd9fa292..eb690f14 100644 --- a/code/model/VirtualPage.php +++ b/code/model/VirtualPage.php @@ -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;