From 023778c002cd0793845c5a4cc652a42ae29e7116 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Mon, 1 Oct 2007 05:23:17 +0000 Subject: [PATCH] fixed virtual page creation. yay! git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42849 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/VirtualPage.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/model/VirtualPage.php b/core/model/VirtualPage.php index a76a10659..e3fa6574c 100755 --- a/core/model/VirtualPage.php +++ b/core/model/VirtualPage.php @@ -88,8 +88,10 @@ class VirtualPage extends Page { function onBeforeWrite() { // Don't do this stuff when we're publishing if(!$this->extension_instances['Versioned']->migratingVersion) { - if(($this->changed['CopyContentFromID'] || !$this->Content) && $this->class == 'VirtualPage' ) { - $source = $this->CopyContentFrom(); + if(isset($this->changed['CopyContentFromID']) && $this->changed['CopyContentFromID'] + && $this->CopyContentFromID != 0 && $this->class == 'VirtualPage' ) { + $CopyContentFromID = $this->CopyContentFromID; + $source = DataObject::get_one("Sitetree","`Sitetree`.`ID`='$CopyContentFromID'"); $this->copyFrom($source); $this->URLSegment = $source->URLSegment . '-' . $this->ID; }