From 6441e8d73ce00ea7b10f90118e03634c1778110a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 28 Feb 2015 20:09:22 -0500 Subject: [PATCH] CRM-11900 - Fix tpl variables messed up by smarty.help --- CRM/Core/Smarty/plugins/function.help.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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'])); -- 2.25.1