From 3a8e9315966f24f13fd9b5d20be9b1d9c41813e1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 20 Apr 2014 23:18:37 -0700 Subject: [PATCH] API - Cleanup getfield return values --- api/v3/Generic.php | 12 ++++++++---- api/v3/utils.php | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 850740a494..13bcdfa789 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -80,7 +80,9 @@ function civicrm_api3_generic_getfields($apiRequest) { case 'delete': $metadata = array( - 'id' => array('title' => 'Unique Identifier', + 'id' => array( + 'title' => $entity . ' ID', + 'name' => 'id', 'api.required' => 1, 'api.aliases' => array($lcase_entity . '_id'), 'type' => CRM_Utils_Type::T_INT, @@ -90,11 +92,13 @@ function civicrm_api3_generic_getfields($apiRequest) { case 'getoptions': $metadata = array( 'field' => array( - 'title' => 'Field to retrieve options for', + 'name' => 'field', + 'title' => 'Field name', 'api.required' => 1, ), 'context' => array( - 'title' => 'Context string', + 'name' => 'context', + 'title' => 'Context', ), ); break; @@ -258,7 +262,7 @@ function civicrm_api3_generic_getoptions($apiRequest) { * @param array $fieldsToResolve anny field resolutions specifically requested */ function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fieldname, $fieldSpec, $fieldsToResolve){ - if (empty($fieldSpec['pseudoconstant'])) { + if (empty($fieldSpec['pseudoconstant']) && empty($fieldSpec['option_group_id'])) { return; } diff --git a/api/v3/utils.php b/api/v3/utils.php index 6a4b449677..ebb0a0cad1 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -1453,6 +1453,7 @@ function _civicrm_api_get_custom_fields($entity, &$params) { foreach ($customfields as $key => $value) { // Regular fields have a 'name' property $value['name'] = 'custom_' . $key; + $value['title'] = $value['label']; $value['type'] = _getStandardTypeFromCustomDataType($value['data_type']); $ret['custom_' . $key] = $value; } -- 2.25.1