From cecd68aebea00ec2df40fe840712ddb097d827c6 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 29 Sep 2023 18:49:35 +1300 Subject: [PATCH] Replace smarty.get with assigned snippet_type in tpl --- CRM/Core/Smarty.php | 1 + templates/CRM/Form/validate.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 41de354b17e7..60f6cfcb0973 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -136,6 +136,7 @@ private function initialize() { 'cacheCleanup' => CRM_Utils_Request::retrieveValue('cacheCleanup', 'Integer'), 'configReset' => CRM_Utils_Request::retrieveValue('configReset', 'Integer'), ]); + $this->assign('snippet_type', CRM_Utils_Request::retrieveValue('snippet', 'String')); $tsLocale = CRM_Core_I18n::getLocale(); $this->assign('tsLocale', $tsLocale); diff --git a/templates/CRM/Form/validate.tpl b/templates/CRM/Form/validate.tpl index 297364a9d6ec..4740d0b687a3 100644 --- a/templates/CRM/Form/validate.tpl +++ b/templates/CRM/Form/validate.tpl @@ -9,7 +9,7 @@ *} {* Initialize jQuery validate on a form *} {* Extra params and functions may be added to the CRM.validate object before this template is loaded *} -{if empty($crm_form_validate_included) && ((isset($smarty.get.snippet|smarty:nodefaults) && $smarty.get.snippet neq 'json') || !isset($smarty.get.snippet|smarty:nodefaults)) && !empty($form) && !empty($form.formClass)} +{if empty($crm_form_validate_included) && $snippet_type neq 'json' && !empty($form) && !empty($form.formClass)} {assign var=crm_form_validate_included value=1} {literal}