BUGFIX: fixed onBeforeDuplicate calling before page existed

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96879 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Will Rossiter 2010-01-13 21:24:33 +00:00 committed by Sam Minnee
parent a6da69818b
commit d3856638b9

View File

@ -504,13 +504,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*/
public function duplicate($doWrite = true) {
$this->extend('onBeforeDuplicate', $page);
$page = parent::duplicate(false);
$page->Sort = 0;
$this->extend('onBeforeDuplicate', $page);
if($doWrite) {
$page->write();
}
$this->extend('onAfterDuplicate', $page);
return $page;
}