get a mapping with custom field names (eg. custom_21)

This commit is contained in:
Marc Michalsky forumZFD 2020-09-29 08:48:42 +02:00
parent 9e3ffbb43e
commit 746ed45f04
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -197,6 +197,25 @@ class CustomField {
} }
} }
/**
* Get a custom field mapping
*
* @return array
* @throws \CiviCRM_API3_Exception
*/
public static function getMapping() {
$customFields = CustomField::fetch();
$customFieldMapping = [];
foreach ($customFields as $customField) {
$customFieldMapping[$customField->getName()] = 'custom_' . $customField->getId();
}
return $customFieldMapping;
}
/** /**
* @param string $custom_group_id * @param string $custom_group_id
* *