Merge pull request #5227 from totten/master-abtest-returnurl
[civicrm-core.git] / api / v3 / CustomValue.php
index 464e70d925c1a3d91fb6fd3ea0415d47240f3237..d3b67a3533efe4039f861dfd44d03f7c8b98a133 100644 (file)
  */
 
 /**
- * File for the CiviCRM APIv3 custom value functions
+ * This api exposes CiviCRM custom value.
  *
  * @package CiviCRM_APIv3
- * @subpackage API_CustomField
- *
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: CustomField.php 30879 2010-11-22 15:45:55Z shot $
  */
 
 
@@ -42,7 +38,8 @@
  * @param array $params
  *   Expected keys are in format custom_fieldID:recordID or custom_groupName:fieldName:recordID.
  *
- * @example
+ * @example:
+ * @code
  *   // entity ID. You do not need to specify entity type, we figure it out based on the fields you're using
  *   'entity_id' => 123,
  *   // (omitting :id) inserts or updates a field in a single-valued group
  *   // inserts another new record in multi-valued group
  *   'custom_33:-2' => value,
  *   // you can use group_name:field_name instead of ID
- *   'custom_some_group:my_field => 'myinfo',
+ *   'custom_some_group:my_field' => 'myinfo',
  *   // updates record ID 8 in my_other_field in multi-valued some_big_group
- *   'custom_some_big_group:my_other_field:8 => 'myinfo',
- *
+ *   'custom_some_big_group:my_other_field:8' => 'myinfo',
+ * @endcode
  *
  * @throws Exception
  * @return array
  *   ['values' => TRUE] or ['is_error' => 1, 'error_message' => 'what went wrong']
- *
  */
 function civicrm_api3_custom_value_create($params) {
   // @todo it's not clear where the entity_table is used as  CRM_Core_BAO_CustomValueTable::setValues($create)
@@ -106,7 +102,7 @@ function civicrm_api3_custom_value_create($params) {
   if ($result['is_error']) {
     throw new Exception($result['error_message']);
   }
-  return civicrm_api3_create_success(TRUE, $params);
+  return civicrm_api3_create_success(TRUE, $params, 'CustomValue');
 }
 
 /**
@@ -115,7 +111,7 @@ function civicrm_api3_custom_value_create($params) {
  * The metadata is used for setting defaults, documentation & validation.
  *
  * @param array $params
- *   Array or parameters determined by getfields.
+ *   Array of parameters determined by getfields.
  */
 function _civicrm_api3_custom_value_create_spec(&$params) {
   $params['entity_id']['api.required'] = 1;
@@ -136,8 +132,6 @@ function _civicrm_api3_custom_value_create_spec(&$params) {
  *
  * @throws API_Exception
  * @return array
- *
- *
  */
 function civicrm_api3_custom_value_get($params) {
 
@@ -175,7 +169,7 @@ function civicrm_api3_custom_value_get($params) {
   if ($result['is_error']) {
     if ($result['error_message'] == "No values found for the specified entity ID and custom field(s).") {
       $values = array();
-      return civicrm_api3_create_success($values, $params);
+      return civicrm_api3_create_success($values, $params, 'CustomValue');
     }
     else {
       throw new API_Exception($result['error_message']);
@@ -223,17 +217,17 @@ function civicrm_api3_custom_value_get($params) {
       $values[$id]['id'] = $id;
       $values[$id][$n] = $value;
     }
-    return civicrm_api3_create_success($values, $params);
+    return civicrm_api3_create_success($values, $params, 'CustomValue');
   }
 }
 
 /**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
  *
  * The metadata is used for setting defaults, documentation & validation.
  *
  * @param array $params
- *   Array or parameters determined by getfields.
+ *   Array of parameters determined by getfields.
  */
 function _civicrm_api3_custom_value_get_spec(&$params) {
   $params['entity_id']['api.required'] = 1;