Afform - Fix help_pre and help_post from custom fields
authorColeman Watts <coleman@civicrm.org>
Tue, 30 Mar 2021 14:49:20 +0000 (10:49 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 30 Mar 2021 14:49:20 +0000 (10:49 -0400)
Previously, default help_pre and help_post would not show if set for a custom field.

ext/afform/core/Civi/Afform/AfformMetadataInjector.php
ext/afform/core/ang/af/afField.html

index 992adfdbf3075f040ca16a0d1d2b9d0b0ba8014c..f24b1bc16c4976b7986b932b761a700fe63566f2 100644 (file)
@@ -91,7 +91,7 @@ class AfformMetadataInjector {
     $params = [
       'action' => $action,
       'where' => [['name', '=', $fieldName]],
-      'select' => ['label', 'input_type', 'input_attrs', 'options'],
+      'select' => ['label', 'input_type', 'input_attrs', 'help_pre', 'help_post', 'options'],
       'loadOptions' => ['id', 'label'],
       // If the admin included this field on the form, then it's OK to get metadata about the field regardless of user permissions.
       'checkPermissions' => FALSE,
index 1d41d2cc13c1c21e593dc15d7233551d5ad3a597..88e226c43b63e2a3fe973c79596f90650c97db1b 100644 (file)
@@ -1,6 +1,6 @@
-<label class="crm-af-field-label" ng-if="$ctrl.defn.label" for="{{:: fieldId }}">
+<label class="crm-af-field-label" ng-if=":: $ctrl.defn.label" for="{{:: fieldId }}">
   {{:: $ctrl.defn.label }}
 </label>
-<p class="crm-af-field-help-pre" ng-if="$ctrl.defn.help_pre">{{:: $ctrl.defn.help_pre }}</p>
+<p class="crm-af-field-help-pre" ng-if=":: $ctrl.defn.help_pre">{{:: $ctrl.defn.help_pre }}</p>
 <div class="crm-af-field" ng-include="'~/af/fields/' + $ctrl.defn.input_type + '.html'"></div>
-<p class="crm-af-field-help-post" ng-if="$ctrl.defn.help_post">{{:: $ctrl.defn.help_post }}</p>
+<p class="crm-af-field-help-post" ng-if=":: $ctrl.defn.help_post">{{:: $ctrl.defn.help_post }}</p>