MINOR: added hooks for extending duplicate page functionality (from r96877)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102410 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 03:28:07 +00:00
parent 8d2d4bca68
commit 7b3e45539b

View File

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