API - Cleanup getfield return values
authorColeman Watts <coleman@civicrm.org>
Mon, 21 Apr 2014 06:18:37 +0000 (23:18 -0700)
committerColeman Watts <coleman@civicrm.org>
Mon, 21 Apr 2014 06:18:37 +0000 (23:18 -0700)
api/v3/Generic.php
api/v3/utils.php

index 850740a494b6519a40b2bb8f8a24e6fc0f57f15c..13bcdfa7891f156710797c120aac905217630b16 100644 (file)
@@ -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;
   }
 
index 6a4b4496770b14d7d89bab669106e8e335805dcf..ebb0a0cad1a1f9f6ebcee74b7f06ed8cc40d4dcc 100644 (file)
@@ -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;
   }