* {/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);
- }
-}