From 954dec5c6040832929f0ee9d5cb66c2ccbe538c9 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 28 Jul 2023 15:18:56 +1200 Subject: [PATCH] Use array_key_exists instead of not empty in tpl --- templates/CRM/Core/Form/Field.tpl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/templates/CRM/Core/Form/Field.tpl b/templates/CRM/Core/Form/Field.tpl index b2d5ba396b..83c244181a 100644 --- a/templates/CRM/Core/Form/Field.tpl +++ b/templates/CRM/Core/Form/Field.tpl @@ -7,15 +7,16 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if !empty($fieldSpec.template)} +{if array_key_exists('template', $fieldSpec)} {include file=$fieldSpec.template} {else} {$form.$fieldName.label} - {if !empty($fieldSpec.help|smarty:nodefaults)}{assign var=help value=$fieldSpec.help}{help id=$help.id file=$help.file}{/if} - {if $action == 2 && !empty($fieldSpec.is_add_translate_dialog)}{include file='CRM/Core/I18n/Dialog.tpl' table=$entityTable field=$fieldName id=$entityID}{/if} + {if array_key_exists('help', $fieldSpec)}{assign var=help value=$fieldSpec.help}{help id=$help.id file=$help.file}{/if} + {if $action == 2 && array_key_exists('is_add_translate_dialog', $fieldSpec)}{include file='CRM/Core/I18n/Dialog.tpl' table=$entityTable field=$fieldName id=$entityID}{/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 array_key_exists('pre_html_text', $fieldSpec)}{$fieldSpec.pre_html_text}{/if}{if $form.$fieldName.html}{$form.$fieldName.html}{else}{$fieldSpec.place_holder}{/if}{if array_key_exists('post_html_text', $fieldSpec)}{$fieldSpec.post_html_text}{/if}
+ {if array_key_exists('description', $fieldSpec)}{$fieldSpec.description}{/if} + {if array_key_exists('documentation_link', $fieldSpec)}{docURL page=$fieldSpec.documentation_link.page resource=$fieldSpec.documentation_link.resource}{/if} {/if} -- 2.25.1