From 969afb18b946f164cee3b0b8dbcdffdd0b839551 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 2 Nov 2018 10:05:48 +1300 Subject: [PATCH] Fix help for financial acls. I've done this by using the field template that is used by entity forms & adding help to the spec (which I'll document). I noted in this that entityTrait used a different field key for the documentation link - literally documentation_link whereas I had used field_link so I fixed settings to match --- CRM/Admin/Form/SettingTrait.php | 7 +------ settings/Contribute.setting.php | 1 + settings/Event.setting.php | 2 +- settings/Multisite.setting.php | 2 +- templates/CRM/Core/Form/Field.tpl | 2 +- templates/CRM/Form/basicFormFields.tpl | 29 ++++++-------------------- 6 files changed, 11 insertions(+), 32 deletions(-) diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 15de133812..03aa91fc62 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -143,11 +143,6 @@ trait CRM_Admin_Form_SettingTrait { $this->includesReadOnlyFields = TRUE; } - if (isset($props['help_link'])) { - // Set both the value in this loop & the outer value as we assign both to the template while we deprecate the $descriptions assignment. - $settingMetaData[$setting]['description'] = $props['description'] .= ' ' . CRM_Utils_System::docURL2($props['help_link']['page'], NULL, NULL, NULL, NULL, $props['help_link']['resource']); - - } $add = 'add' . $quickFormType; if ($add == 'addElement') { $this->$add( @@ -162,7 +157,7 @@ trait CRM_Admin_Form_SettingTrait { $this->addElement('select', $setting, ts($props['title']), $options, CRM_Utils_Array::value('html_attributes', $props)); } elseif ($add == 'addCheckBox') { - $this->addCheckBox($setting, ts($props['title']), $options, NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, ['  ']); + $this->addCheckBox($setting, '', $options, NULL, CRM_Utils_Array::value('html_attributes', $props), NULL, NULL, ['  ']); } elseif ($add == 'addCheckBoxes') { $options = array_flip($options); diff --git a/settings/Contribute.setting.php b/settings/Contribute.setting.php index 22bdd134fd..213271e2a3 100644 --- a/settings/Contribute.setting.php +++ b/settings/Contribute.setting.php @@ -101,6 +101,7 @@ return array( 'is_contact' => 0, 'description' => NULL, 'help_text' => NULL, + 'help' => ['id' => 'acl_financial_type'], ), 'deferred_revenue_enabled' => array( 'group_name' => 'Contribute Preferences', diff --git a/settings/Event.setting.php b/settings/Event.setting.php index 70d0ddb767..e9ce8749f4 100644 --- a/settings/Event.setting.php +++ b/settings/Event.setting.php @@ -48,7 +48,7 @@ return array( 'is_contact' => 0, 'description' => ts('This feature allows users to register for more than one event at a time. When enabled, users will add event(s) to a "cart" and then pay for them all at once. Enabling this setting will affect online registration for all active events. The code is an alpha state, and you will potentially need to have developer resources to debug and fix sections of the codebase while testing and deploying it'), 'help_text' => '', - 'help_link' => ['page' => 'CiviEvent Cart Checkout', 'resource' => 'wiki'], + 'documentation_link' => ['page' => 'CiviEvent Cart Checkout', 'resource' => 'wiki'], ), 'show_events' => array( 'name' => 'show_events', diff --git a/settings/Multisite.setting.php b/settings/Multisite.setting.php index c7c6bfb04d..a6b287a789 100644 --- a/settings/Multisite.setting.php +++ b/settings/Multisite.setting.php @@ -48,7 +48,7 @@ return array( 'is_domain' => 1, 'is_contact' => 0, 'description' => ts('Make CiviCRM aware of multiple domains. You should configure a domain group if enabled'), - 'help_link' => ['page' => 'Multi Site Installation', 'resource' => 'wiki'], + 'documentation_link' => ['page' => 'Multi Site Installation', 'resource' => 'wiki'], 'help_text' => NULL, ), 'domain_group_id' => array( diff --git a/templates/CRM/Core/Form/Field.tpl b/templates/CRM/Core/Form/Field.tpl index 026a009d1a..fb6a01eee9 100644 --- a/templates/CRM/Core/Form/Field.tpl +++ b/templates/CRM/Core/Form/Field.tpl @@ -35,6 +35,6 @@ {if $form.$fieldName.html}{if $fieldSpec.formatter === 'crmMoney'}{$form.$fieldName.html|crmMoney}{else}{$form.$fieldName.html}{/if}{else}{$fieldSpec.place_holder}{/if}
{if $fieldSpec.description}{$fieldSpec.description}{/if} - {if $fieldSpec.documentation_link}{docURL page=$fieldSpec.documentation_link.page}{/if} + {if $fieldSpec.documentation_link}{docURL page=$fieldSpec.documentation_link.page resource=$fieldSpec.documentation_link.resource}{/if} {/if} diff --git a/templates/CRM/Form/basicFormFields.tpl b/templates/CRM/Form/basicFormFields.tpl index 8dc9f6fe99..93725f14c0 100644 --- a/templates/CRM/Form/basicFormFields.tpl +++ b/templates/CRM/Form/basicFormFields.tpl @@ -25,28 +25,11 @@ *} {* @todo with a small amount of tinkering most of this can be replaced by re-using the foreach loop in CRM_Core_EntityForm.tpl *} - {foreach from=$fields item=field key=fieldName} - {assign var=n value=$fieldName} - {if $form.$n} - - {if $field.html_type EQ 'checkbox'|| $field.html_type EQ 'checkboxes'} - - - {else} - - - {/if} - - {/if} + + {foreach from=$fields item=fieldSpec} + {assign var=fieldName value=$fieldSpec.name} + + {include file="CRM/Core/Form/Field.tpl"} + {/foreach}
- {$form.$n.html} - {if $field.description} -
{$field.description} - {/if} -
{$form.$n.label} - {$form.$n.html} - {if $field.description} -
{$field.description} - {/if} -
-- 2.25.1