+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
*/
/**
- * File for the CiviCRM APIv3 user framework group functions
+ * This api exposes CiviCRM profile field.
*
* @package CiviCRM_APIv3
- * @subpackage API_UF
- *
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: UFField.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
* Defines 'uf field' within a group.
*
* @param array $params
- * Array Associative array of property name/value pairs to create new uf field.
+ * Array per getfields metadata.
*
* @throws API_Exception
*
$field_type = CRM_Utils_Array::value('field_type', $params);
$field_name = CRM_Utils_Array::value('field_name', $params);
- $location_type_id = CRM_Utils_Array::value('location_type_id', $params);
+ $location_type_id = CRM_Utils_Array::value('location_type_id', $params, CRM_Utils_Array::value('website_type_id', $params));
$phone_type = CRM_Utils_Array::value('phone_type_id', $params, CRM_Utils_Array::value('phone_type', $params));
- if (!CRM_Core_BAO_UFField::isValidFieldName($field_name)) {
+ if (strpos($field_name, 'formatting') !== 0 && !CRM_Core_BAO_UFField::isValidFieldName($field_name)) {
throw new API_Exception('The field_name is not valid');
}
$params['field_name'] = array($field_type, $field_name, $location_type_id, $phone_type);
}
/**
- * Gets field for civicrm_uf_field create
+ * Adjust metadata for civicrm_uf_field create.
*
* @param array $params
- *
- * @return void
- * fields valid for other functions
*/
function _civicrm_api3_uf_field_create_spec(&$params) {
$params['option.autoweight'] = array(
- 'title' => "Automatically adjust weights in UFGroup to align with UFField",
+ 'title' => "Auto Weight",
+ 'description' => "Automatically adjust weights in UFGroup to align with UFField",
'type' => CRM_Utils_Type::T_BOOLEAN,
'api.default' => TRUE,
);
- $params['created_id']['api.default'] = 'user_contact_id';
- $params['created_id']['title'] = 'Created By';
$params['is_active']['api.default'] = TRUE;
}
/**
- * Returns array of uf groups (profiles) matching a set of one or more group properties
+ * Returns array of uf groups (profiles) matching a set of one or more group properties.
*
* @param array $params
- * (reference) Array of one or more valid.
- * property_name=>value pairs. If $params is set
- * as null, all surveys will be returned
+ * Array per getfields metadata.
*
* @return array
- * (reference) Array
- * {@getfields UFField_get
- * @example UFFieldGet.php
*/
function civicrm_api3_uf_field_get($params) {
return _civicrm_api3_basic_get('CRM_Core_BAO_UFField', $params);
}
/**
- * Delete uf field
+ * Delete uf field.
*
* @param array $params
*
}
/**
- * field id accepted for backward compatibility - unset required on id
+ * Field id accepted for backward compatibility - unset required on id.
+ *
* @param array $params
*/
function _civicrm_api3_uf_field_delete_spec(&$params) {