More comment fixes
[civicrm-core.git] / api / v3 / CustomField.php
index cd1574e7427ea82aedddd02822a5554c7b12ef6b..bfcf45e4cd34ec6c4f02a6fdd999bcb71ac14fea 100644 (file)
@@ -1,8 +1,7 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  * @version $Id: CustomField.php 30879 2010-11-22 15:45:55Z shot $
  */
 
-/**
- * Most API functions take in associative arrays ( name => value pairs
- * as parameters. Some of the most commonly used parameters are
- * described below
- *
- * @param array $params           an associative array used in construction
- * retrieval of the object
- *
- */
-
 /**
  * Create a 'custom field' within a custom field group.
+ *
  * We also empty the static var in the getfields
  * function after deletion so that the field is available for us (getfields manages date conversion
  * among other things
  *
- * @param $params array  Associative array of property name/value pairs to create new custom field.
- *
- * @return Newly API success object
- *
- * @access public
- *
- * @example CustomFieldCreate.php
- * {@getfields CustomField_create}
- * {@example CustomFieldCreate.php 0}
+ * @param array $params
+ *   Array per getfields metadata.
  *
+ * @return array
+ *   API success array
  */
 function civicrm_api3_custom_field_create($params) {
 
-  // Array created for passing options in params
+  // Array created for passing options in params.
   if (isset($params['option_values']) && is_array($params['option_values'])) {
     foreach ($params['option_values'] as $key => $value) {
       $params['option_label'][$key] = $value['label'];
@@ -82,16 +67,18 @@ function civicrm_api3_custom_field_create($params) {
 }
 
 /**
- * Flush static caches in functions that might have stored available custom fields
+ * Flush static caches in functions that might have stored available custom fields.
  */
-function _civicrm_api3_custom_field_flush_static_caches(){
+function _civicrm_api3_custom_field_flush_static_caches() {
   civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
   CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE);
 }
+
 /**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
  *
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array or parameters determined by getfields.
  */
 function _civicrm_api3_custom_field_create_spec(&$params) {
   $params['label']['api.required'] = 1;
@@ -109,17 +96,12 @@ function _civicrm_api3_custom_field_create_spec(&$params) {
 /**
  * Use this API to delete an existing custom group field.
  *
- * @param $params     Array id of the field to be deleted
+ * @param array $params
+ *   Array id of the field to be deleted.
  *
  * @return array
- * @example CustomFieldDelete.php
- *
- * {@example CustomFieldDelete.php 0}
- * {@getfields CustomField_delete}
- * @access public
- **/
+ */
 function civicrm_api3_custom_field_delete($params) {
-
   $field = new CRM_Core_BAO_CustomField();
   $field->id = $params['id'];
   $field->find(TRUE);
@@ -131,34 +113,37 @@ function civicrm_api3_custom_field_delete($params) {
 /**
  * Use this API to get existing custom fields.
  *
- * @param array $params Array to search on
- *{*
+ * @param array $params
+ *   Array to search on.
  *
  * @return array
-@getfields CustomField_get}
- * @access public
- *
- **/
+ */
 function civicrm_api3_custom_field_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
 /**
- * Helper function to validate custom field value
+ * Helper function to validate custom field value.
+ *
  * @deprecated
  *
- * @param String $fieldName    Custom field name (eg: custom_8 )
- * @param Mixed  $value        Field value to be validate
- * @param Array  $fieldDetails Field Details
- * @param Array  $errors       Collect validation  errors
+ * @param string $fieldName
+ *   Custom field name (eg: custom_8 ).
+ * @param mixed $value
+ *   Field value to be validate.
+ * @param array $fieldDetails
+ *   Field Details.
+ * @param array $errors
+ *   Collect validation errors.
  *
- * @return array  Validation errors
+ * @return array|NULL
+ *   Validation errors
  * @todo remove this function - not in use but need to review functionality before
  * removing as it might be useful in wrapper layer
  */
 function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = array()) {
-    return;
-    //see comment block
+  return NULL;
+  //see comment block
   if (!$value) {
     return $errors;
   }
@@ -263,7 +248,12 @@ SELECT count(*)
 }
 
 /**
- * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom field
+ * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom field.
+ *
+ * @param array $params
+ *   Array per getfields metadata.
+ *
+ * @return array
  */
 function civicrm_api3_custom_field_setvalue($params) {
   require_once 'api/v3/Generic/Setvalue.php';