From db55cddca17dd7cb61b41fb52b4b985ce00ab8aa Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 11 Oct 2023 14:50:09 +1300 Subject: [PATCH] Update smarty localize for Smarty3 --- CRM/Core/Smarty/plugins/block.localize.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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']);