mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
8d2d4bca68
commit
7b3e45539b
@ -496,11 +496,14 @@ 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) {
|
||||||
|
|
||||||
|
$this->extend('onBeforeDuplicate', $page);
|
||||||
$page = parent::duplicate(false);
|
$page = parent::duplicate(false);
|
||||||
$page->Sort = 0;
|
$page->Sort = 0;
|
||||||
if($doWrite) {
|
if($doWrite) {
|
||||||
$page->write();
|
$page->write();
|
||||||
}
|
}
|
||||||
|
$this->extend('onAfterDuplicate', $page);
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user