Commit 17c838d0 authored by colemanw's avatar colemanw
Browse files

Fix loading fields for contact type blocks

parent 760aa9a2
......@@ -354,13 +354,17 @@ function afform_civicrm_alterAngular($angular) {
* @throws API_Exception
*/
function _af_fill_field_metadata($entityType, DOMElement $afField) {
$fieldName = $afField->getAttribute('name');
$getFields = civicrm_api4($entityType, 'getFields', [
$params = [
'action' => 'create',
'where' => [['name', '=', $fieldName]],
'where' => [['name', '=', $afField->getAttribute('name')]],
'select' => ['title', 'input_type', 'input_attrs', 'options'],
'loadOptions' => TRUE,
]);
];
if (in_array($entityType, CRM_Contact_BAO_ContactType::basicTypes(TRUE))) {
$params['values'] = ['contact_type' => $entityType];
$entityType = 'Contact';
}
$getFields = civicrm_api4($entityType, 'getFields', $params);
// Merge field definition data with whatever's already in the markup
$deep = ['input_attrs'];
foreach ($getFields as $fieldInfo) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment