From a419926de541cb2ece9ddfe1a2a8a476a2103b5f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 3 Feb 2015 21:42:47 -0500 Subject: [PATCH] getfields api - ensure 'name' property is set for every field --- api/v3/Generic.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/v3/Generic.php b/api/v3/Generic.php index daf416e65c..4dc53d259d 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -142,6 +142,10 @@ function civicrm_api3_generic_getfields($apiRequest) { $fieldsToResolve = (array) CRM_Utils_Array::value('get_options', $apiOptions, array()); foreach ($metadata as $fieldname => $fieldSpec) { + // Ensure 'name' is set + if (!isset($fieldSpec['name'])) { + $metadata[$fieldname]['name'] = $fieldname; + } _civicrm_api3_generic_get_metadata_options($metadata, $apiRequest, $fieldname, $fieldSpec, $fieldsToResolve); } -- 2.25.1