diff --git a/core/components/babel/elements/plugins/babel.plugin.php b/core/components/babel/elements/plugins/babel.plugin.php index fc804bb..6c0ab15 100644 --- a/core/components/babel/elements/plugins/babel.plugin.php +++ b/core/components/babel/elements/plugins/babel.plugin.php @@ -286,7 +286,19 @@ case 'OnResourceDuplicate': /* init Babel TV of duplicated resources */ $resource =& $modx->event->params['newResource']; - $babel->initBabelTv($resource); + + function initBabelTvsRecursive(&$modx, &$babel, $resource = null, $depth= 100) { + if ( $resource && $depth > 0) { + $children = $resource->getMany('Children'); + foreach ($children as $child) { + $processDepth = $depth - 1; + initBabelTvsRecursive($modx, $babel, $child,$processDepth); + } + $babel->initBabelTv($resource); + } + } + + initBabelTvsRecursive($modx,$babel,$resource); break; } -return; \ No newline at end of file +return;