From: Coleman Watts Date: Sun, 1 Mar 2015 01:09:22 +0000 (-0500) Subject: CRM-11900 - Fix tpl variables messed up by smarty.help X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6441e8d73ce00ea7b10f90118e03634c1778110a;p=civicrm-core.git CRM-11900 - Fix tpl variables messed up by smarty.help --- diff --git a/CRM/Core/Smarty/plugins/function.help.php b/CRM/Core/Smarty/plugins/function.help.php index d070f3e939..ec044bcaa9 100644 --- a/CRM/Core/Smarty/plugins/function.help.php +++ b/CRM/Core/Smarty/plugins/function.help.php @@ -59,15 +59,19 @@ function smarty_function_help($params, &$smarty) { $params['file'] = str_replace(array('.tpl', '.hlp'), '', $params['file']); if (empty($params['title'])) { - // Avod overwriting existing vars CRM-11900 - $oldID = $smarty->get_template_vars('id'); + $vars = $smarty->get_template_vars(); $smarty->assign('id', $params['id'] . '-title'); $name = trim($smarty->fetch($params['file'] . '.hlp')); $additionalTPLFile = $params['file'] . '.extra.hlp'; if ($smarty->template_exists($additionalTPLFile)) { $name .= trim($smarty->fetch($additionalTPLFile)); } - $smarty->assign('id', $oldID); + // Ensure we didn't change any existing vars CRM-11900 + foreach ($vars as $key => $value) { + if ($smarty->get_template_vars($key) !== $value) { + $smarty->assign($key, $value); + } + } } else { $name = trim(strip_tags($params['title']));