From 60b82ab606a118f7c07bbc193857aebf043da7e5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 24 Nov 2020 23:14:31 -0800 Subject: [PATCH] _af_fill_field_metadata() - Provide metadata about selected fields (regardless of DB permissions) --- ext/afform/core/afform.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index b73043d1fb..a5c4584849 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -392,8 +392,9 @@ function _af_fill_field_metadata($entityType, DOMElement $afField) { $params['values'] = ['contact_type' => $entityType]; $entityType = 'Contact'; } - $getFields = civicrm_api4($entityType, 'getFields', $params); - // Merge field definition data with whatever's already in the markup + // Merge field definition data with whatever's already in the markup. + // If the admin has chosen to include this field on the form, then it's OK for us to get metadata about the field - regardless of user's other permissions. + $getFields = civicrm_api4($entityType, 'getFields', $params + ['checkPermissions' => FALSE]); $deep = ['input_attrs']; foreach ($getFields as $fieldInfo) { $existingFieldDefn = trim(pq($afField)->attr('defn') ?: ''); -- 2.25.1