From: Eileen McNaughton Date: Wed, 11 Oct 2023 01:50:09 +0000 (+1300) Subject: Update smarty localize for Smarty3 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=db55cddca17dd7cb61b41fb52b4b985ce00ab8aa;p=civicrm-core.git Update smarty localize for Smarty3 --- diff --git a/CRM/Core/Smarty/plugins/block.localize.php b/CRM/Core/Smarty/plugins/block.localize.php index 47e64fe6be..6b7f357d85 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']);