#108 - Subsite Virtual Page ordering (from r84848)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89186 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-10-15 22:27:48 +00:00
parent 500ce4a91d
commit 1fed31cb9e

View File

@ -514,7 +514,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return SiteTree The duplicated object. * @return SiteTree The duplicated object.
*/ */
public function duplicate($doWrite = true) { public function duplicate($doWrite = true) {
$page = parent::duplicate($doWrite); $page = parent::duplicate(false);
$page->Sort = 0;
if($doWrite) {
$page->write();
}
return $page; return $page;
} }
@ -552,6 +556,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
public function duplicateAsChild($id) { public function duplicateAsChild($id) {
$newSiteTree = $this->duplicate(); $newSiteTree = $this->duplicate();
$newSiteTree->ParentID = $id; $newSiteTree->ParentID = $id;
$newSiteTree->Sort = 0;
$newSiteTree->write(); $newSiteTree->write();
} }