From debc410a60e05dd33484255beb39156a1c1b1f7c Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 12 Dec 2012 16:44:18 +0100 Subject: [PATCH] Added a callback hook "onTranslatableCreate" that can be used to create translations of dependent objects --- code/model/Translatable.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index 2dbba2e..b5dc126 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -1323,6 +1323,11 @@ class Translatable extends DataExtension implements PermissionProvider { $newTranslation->_TranslationGroupID = $translationGroupID ? $translationGroupID : $this->owner->ID; if($saveTranslation) $newTranslation->write(); + // run callback on page for translation related hooks + if($newTranslation->hasMethod('onTranslatableCreate')){ + $newTranslation->onTranslatableCreate($saveTranslation); + } + return $newTranslation; }