From 8ad2d066a0bd9bdfbfd77204de5b1ab0780e2495 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 1 Mar 2021 15:07:19 +1300 Subject: [PATCH] Enable & do single field metadata conversion for defaultContactCountry This builds on https://github.com/civicrm/civicrm-core/pull/19629 Our intention is that we should be building functionality into this form that is actually used in core. It's a bit tricky to swap out all fields at once but this makes them individually swap-outable. Only defaultContactCountry is swapped out. I looked a little at the help_text issue - the text actually does work if you add it since it's already in the hlp file but I decided this broke consistency less (using description) as other fields on the form do that and look similar. Also, when the text is really just a bit of text (not a long help text) it makes sense. (Otherwise I'd need to trawl through resolving the bigger issue and I didn't want to bring that into scope) --- .../CRM/Admin/Form/Setting/Localization.tpl | 7 ++----- .../CRM/Admin/Form/Setting/SettingField.tpl | 18 ++++++++++++++++++ .../CRM/Admin/Form/Setting/SettingForm.tpl | 19 ++----------------- 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 templates/CRM/Admin/Form/Setting/SettingField.tpl diff --git a/templates/CRM/Admin/Form/Setting/Localization.tpl b/templates/CRM/Admin/Form/Setting/Localization.tpl index be6d4b5c9a..de22fc47b2 100644 --- a/templates/CRM/Admin/Form/Setting/Localization.tpl +++ b/templates/CRM/Admin/Form/Setting/Localization.tpl @@ -69,7 +69,7 @@ {$form.moneyformat.label} {help id='moneyformat' title=$form.moneyformat.label} {$form.moneyformat.html} - + {$form.customTranslateFunction.label} {help id='customTranslateFunction' title=$form.customTranslateFunction.label} {$form.customTranslateFunction.html} @@ -84,10 +84,7 @@

{ts}Contact Address Fields - Selection Values{/ts}

- - - - + {include file='CRM/Admin/Form/Setting/SettingField.tpl' setting_name='defaultContactCountry' fieldSpec=$settings_fields.defaultContactCountry} diff --git a/templates/CRM/Admin/Form/Setting/SettingField.tpl b/templates/CRM/Admin/Form/Setting/SettingField.tpl new file mode 100644 index 0000000000..0182f99bf8 --- /dev/null +++ b/templates/CRM/Admin/Form/Setting/SettingField.tpl @@ -0,0 +1,18 @@ +{* Display setting field from metadata - todo consolidate with CRM_Core_Form_Field.tpl *} + + + + diff --git a/templates/CRM/Admin/Form/Setting/SettingForm.tpl b/templates/CRM/Admin/Form/Setting/SettingForm.tpl index 99ec6404e5..d128edfc13 100644 --- a/templates/CRM/Admin/Form/Setting/SettingForm.tpl +++ b/templates/CRM/Admin/Form/Setting/SettingForm.tpl @@ -9,23 +9,8 @@ *}
{include file="CRM/common/formButtons.tpl" location="top"}
{$form.defaultContactCountry.label} {help id='defaultContactCountry' title=$form.defaultContactCountry.label}{$form.defaultContactCountry.html}
{$form.pinnedContactCountries.label} {help id='pinnedContactCountries' title=$form.pinnedContactCountries.label} {$form.pinnedContactCountries.html}
{$form.$setting_name.label} + {if !empty($fieldSpec.wrapper_element)} + {$fieldSpec.wrapper_element.0}{$form.$setting_name.html}{$fieldSpec.wrapper_element.1} + {else} + {$form.$setting_name.html} + {/if} +
+ {$fieldSpec.description} +
+ {if $fieldSpec.help_text} + {* @todo the appended -id here appears to be inconsistent in the hlp files *} + {assign var='tplhelp_id' value = $setting_name|cat:'-id'|replace:'_':'-'}{help id="$tplhelp_id"} + {/if} +
- {foreach from=$settings_fields key="setting_name" item="setting_detail"} - - - - + {foreach from=$settings_fields key="setting_name" item="fieldSpec"} + {include file="CRM/Admin/Form/Setting/SettingField.tpl"} {/foreach}
{$form.$setting_name.label} - {if !empty($setting_detail.wrapper_element)} - {$setting_detail.wrapper_element.0}{$form.$setting_name.html}{$setting_detail.wrapper_element.1} - {else} - {$form.$setting_name.html} - {/if} -
- {$setting_detail.description} -
- {if $setting_detail.help_text} - {assign var='tplhelp_id' value = $setting_name|cat:'-id'|replace:'_':'-'}{help id="$tplhelp_id"} - {/if} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
-- 2.25.1