X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSmarty%2Fplugins%2Fblock.crmScope.php;h=66bb8bcb4fdac8098422820dd4d87ae1d74c588a;hb=4c12c9b771bde931077f56685b632bd34504b238;hp=b37050b326d95867975dce14fff6eddc014c0e57;hpb=af002a7d80740dd4e6369d2ffc11e64e89784cfd;p=civicrm-core.git diff --git a/CRM/Core/Smarty/plugins/block.crmScope.php b/CRM/Core/Smarty/plugins/block.crmScope.php index b37050b326..66bb8bcb4f 100644 --- a/CRM/Core/Smarty/plugins/block.crmScope.php +++ b/CRM/Core/Smarty/plugins/block.crmScope.php @@ -15,42 +15,28 @@ * {/tsScope} * @endcode * - * @param array $params must define 'name' - * @param string $content Default content - * @param object $smarty the Smarty object + * @param array $params + * Must define 'name'. + * @param string $content + * Default content. + * @param CRM_Core_Smarty $smarty + * The Smarty object. * * @param $repeat * * @return string */ function smarty_block_crmScope($params, $content, &$smarty, &$repeat) { - // A list of variables/values to save temporarily - static $backupFrames = array(); + /** @var CRM_Core_Smarty $smarty */ if ($repeat) { // open crmScope - $vars = $smarty->get_template_vars(); - $backupFrame = array(); - foreach ($params as $key => $value) { - $backupFrame[$key] = isset($vars[$key]) ? $vars[$key] : NULL; - } - $backupFrames[] = $backupFrame; - _smarty_block_crmScope_applyFrame($smarty, $params); + $smarty->pushScope($params); } else { // close crmScope - _smarty_block_crmScope_applyFrame($smarty, array_pop($backupFrames)); + $smarty->popScope(); } return $content; } - -/** - * @param $smarty - * @param $frame - */ -function _smarty_block_crmScope_applyFrame(&$smarty, $frame) { - foreach ($frame as $key => $value) { - $smarty->assign($key, $value); - } -}