diff --git a/CRM/Core/Smarty/plugins/block.localize.php b/CRM/Core/Smarty/plugins/block.localize.php index 47e64fe6be3d..6b7f357d85ee 100644 --- a/CRM/Core/Smarty/plugins/block.localize.php +++ b/CRM/Core/Smarty/plugins/block.localize.php @@ -33,18 +33,19 @@ * @return string * multilingualized query */ -function smarty_block_localize($params, $text, &$smarty, &$repeat) { +function smarty_block_localize($params, $text, $smarty, &$repeat) { if ($repeat) { // For opening tag text is always null return ''; } - - if (!array_key_exists('multilingual', $smarty->_tpl_vars) || !$smarty->_tpl_vars['multilingual']) { + $multiLingual = method_exists($smarty, 'get_template_vars') ? $smarty->get_template_vars('multilingual') : $smarty->getTemplateVars('multilingual'); + if (!$multiLingual) { return $text; } $lines = []; - foreach ($smarty->_tpl_vars['locales'] as $locale) { + $locales = (array) (method_exists($smarty, 'get_template_vars') ? $smarty->get_template_vars('locales') : $smarty->getTemplateVars('locales')); + foreach ($locales as $locale) { $line = $text; if (isset($params['field'])) { $fields = explode(',', $params['field']);