From: colemanw Date: Wed, 4 Oct 2023 12:32:03 +0000 (-0400) Subject: Afform - Use list of allowed operators if set on the form, adjust width X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=29122482d2032fde02972b79c19948c093382d6e;p=civicrm-core.git Afform - Use list of allowed operators if set on the form, adjust width --- diff --git a/ext/afform/core/Civi/Afform/AfformMetadataInjector.php b/ext/afform/core/Civi/Afform/AfformMetadataInjector.php index e92c638006..99ccaf77e2 100644 --- a/ext/afform/core/Civi/Afform/AfformMetadataInjector.php +++ b/ext/afform/core/Civi/Afform/AfformMetadataInjector.php @@ -126,8 +126,13 @@ class AfformMetadataInjector { // If 'operators' is present in the field definition, use it as a limiter // Afform expects 'operators' in the fieldDefn to be associative key/label, not just a flat array // like it is in the schema. - if (!empty($fieldInfo['operators'])) { - $operators = array_intersect_key($operators, array_flip($fieldInfo['operators'])); + $allowedOperators = $fieldInfo['operators'] ?? NULL; + // Use list of allowed operators if set on the form (should be in js plain array format) + if (!empty($fieldDefn['operators'])) { + $allowedOperators = \CRM_Utils_JS::decode($fieldDefn['operators']); + } + if ($allowedOperators) { + $operators = array_intersect_key($operators, array_flip($allowedOperators)); } $fieldDefn['operators'] = \CRM_Utils_JS::encode($operators); } diff --git a/ext/afform/core/ang/af/afFieldWithSearchOperator.html b/ext/afform/core/ang/af/afFieldWithSearchOperator.html index 3260716756..fbc037c3ef 100644 --- a/ext/afform/core/ang/af/afFieldWithSearchOperator.html +++ b/ext/afform/core/ang/af/afFieldWithSearchOperator.html @@ -1,4 +1,4 @@ -
diff --git a/ext/afform/core/ang/afCore.css b/ext/afform/core/ang/afCore.css index 86c4d09b6c..317cd1c473 100644 --- a/ext/afform/core/ang/afCore.css +++ b/ext/afform/core/ang/afCore.css @@ -36,6 +36,10 @@ af-form { display: inline-block; } +#bootstrap-theme .input-group .afform-search-operator { + width: 6rem; +} + [af-repeat-item] { position: relative; }