From 8a76e0df2748a8d112f1a5d48a96eafc163acad8 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 8 Jun 2021 00:59:14 +0000 Subject: [PATCH] [php8-compact] Add in guards into common templates to assit with fixing test failures on php8 --- templates/CRM/Core/Form/Field.tpl | 10 +++++----- templates/CRM/Form/validate.tpl | 2 +- templates/CRM/common/Tagset.tpl | 8 +++++--- templates/CRM/common/WizardHeader.tpl | 6 +++--- templates/CRM/common/customData.tpl | 8 ++++---- templates/CRM/common/customDataBlock.tpl | 2 +- templates/CRM/common/formButtons.tpl | 2 +- templates/CRM/common/jsortable.tpl | 2 +- templates/CRM/common/showHide.tpl | 2 +- 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/templates/CRM/Core/Form/Field.tpl b/templates/CRM/Core/Form/Field.tpl index d8b8ea42fc..1d59c0e3c3 100644 --- a/templates/CRM/Core/Form/Field.tpl +++ b/templates/CRM/Core/Form/Field.tpl @@ -7,18 +7,18 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $fieldSpec.template} +{if !empty($fieldSpec.template)} {include file=$fieldSpec.template} {else} {$form.$fieldName.label} - {if $fieldSpec.help}{assign var=help value=$fieldSpec.help}{capture assign=helpFile}{if $fieldSpec.help} + {if !empty($fieldSpec.help)}{assign var=help value=$fieldSpec.help}{capture assign=helpFile}{if $fieldSpec.help} {$fieldSpec.help} {else}''{/if} {/capture}{help id=$help.id file=$help.file}{/if} {if $action == 2 && $fieldSpec.is_add_translate_dialog}{include file='CRM/Core/I18n/Dialog.tpl' table=$entityTable field=$fieldName id=$entityID}{/if} - {$fieldSpec.pre_html_text}{if $form.$fieldName.html}{$form.$fieldName.html}{else}{$fieldSpec.place_holder}{/if}{$fieldSpec.post_html_text}
- {if $fieldSpec.description}{$fieldSpec.description}{/if} - {if $fieldSpec.documentation_link}{docURL page=$fieldSpec.documentation_link.page resource=$fieldSpec.documentation_link.resource}{/if} + {if !empty($fieldSpec.pre_html_text)}{$fieldSpec.pre_html_text}{/if}{if $form.$fieldName.html}{$form.$fieldName.html}{else}{$fieldSpec.place_holder}{/if}{if !empty($fieldSpec.post_html_text)}{$fieldSpec.post_html_text}{/if}
+ {if !empty($fieldSpec.description)}{$fieldSpec.description}{/if} + {if !empty($fieldSpec.documentation_link)}{docURL page=$fieldSpec.documentation_link.page resource=$fieldSpec.documentation_link.resource}{/if} {/if} diff --git a/templates/CRM/Form/validate.tpl b/templates/CRM/Form/validate.tpl index 248c0b74ba..6212a41bd8 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 !$crm_form_validate_included and $smarty.get.snippet neq 'json' and $form and $form.formClass} +{if empty($crm_form_validate_included) and !empty($smarty.get.snippet) and $smarty.get.snippet neq 'json' and !empty($form) and !empty($form.formClass)} {assign var=crm_form_validate_included value=1} {literal} -- 2.25.1