Merge pull request #6290 from eileenmcnaughton/CRM-16809
[civicrm-core.git] / api / v3 / CustomField.php
index 068258ce555a9ab2dee3b33b2200d7b9456ed126..1d8daa570bf7113202b5a515f665bc3ac4199a89 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -59,14 +59,14 @@ function civicrm_api3_custom_field_create($params) {
   $customField = CRM_Core_BAO_CustomField::create($params);
   _civicrm_api3_object_to_array_unique_fields($customField, $values[$customField->id]);
   _civicrm_api3_custom_field_flush_static_caches();
-  return civicrm_api3_create_success($values, $params, 'custom_field', $customField);
+  return civicrm_api3_create_success($values, $params, 'CustomField', $customField);
 }
 
 /**
  * Flush static caches in functions that might have stored available custom fields.
  */
 function _civicrm_api3_custom_field_flush_static_caches() {
-  civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
+  civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1));
   CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE);
 }
 
@@ -81,7 +81,8 @@ function _civicrm_api3_custom_field_create_spec(&$params) {
   $params['custom_group_id']['api.required'] = 1;
   $params['is_active']['api.default'] = 1;
   $params['option_type'] = array(
-    'title' => 'This (boolean) field tells the BAO to create an option group for the field if the field type is appropriate',
+    'title' => 'Option Type',
+    'description' => 'This (boolean) field tells the BAO to create an option group for the field if the field type is appropriate',
     'api.default' => 1,
     'type' => CRM_Utils_Type::T_BOOLEAN,
   );
@@ -102,7 +103,7 @@ function civicrm_api3_custom_field_delete($params) {
   $field->id = $params['id'];
   $field->find(TRUE);
   $customFieldDelete = CRM_Core_BAO_CustomField::deleteField($field);
-  civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
+  civicrm_api('CustomField', 'getfields', array('version' => 3, 'cache_clear' => 1));
   return $customFieldDelete ? civicrm_api3_create_error('Error while deleting custom field') : civicrm_api3_create_success();
 }
 
@@ -253,7 +254,7 @@ SELECT count(*)
  */
 function civicrm_api3_custom_field_setvalue($params) {
   require_once 'api/v3/Generic/Setvalue.php';
-  $result = civicrm_api3_generic_setValue(array("entity" => 'custom_field', 'params' => $params));
+  $result = civicrm_api3_generic_setValue(array("entity" => 'CustomField', 'params' => $params));
   if (empty($result['is_error'])) {
     CRM_Utils_System::flushCache();
   }