*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* Business objects for managing custom data fields.
- *
*/
class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
/**
- * Array for valid combinations of data_type & descriptions
+ * Array for valid combinations of data_type & descriptions.
*
* @var array
*/
public static $_dataType = NULL;
/**
- * Array for valid combinations of data_type & html_type
+ * Array for valid combinations of data_type & html_type.
*
* @var array
*/
}
/**
+ * Get data to html array.
+ *
+ * (Does this caching achieve anything?)
+ *
* @return array
*/
public static function dataToHtml() {
*
* @return Object
* DAO object on success, null otherwise
- *
*/
public static function setIsActive($id, $is_active) {
*
* @return string
* name
- *
*/
public static function getTitle($id) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $id, 'label');
*
* @return array
* an array of active custom fields.
- *
*/
public static function &getFields(
$customDataType = 'Individual',
* @param bool $withMultiple
*
* @return array
- *
- *
*/
- public static function &getFieldsForImport(
+ public static function getFieldsForImport(
$contactType = 'Individual',
$showAll = FALSE,
$onlyParent = FALSE,
* The key to parse.
*
* @param bool $all
+ *
* @return int|null
* The id (if exists)
*/
* True if used for search else false.
* @param string $label
* Label for custom field.
- *
*/
public static function addQuickFormElement(
&$qf,
$label = $field->label;
}
- /**
- * at some point in time we might want to split the below into small functions
- **/
+ // at some point in time we might want to split the below into small functions
switch ($widget) {
case 'Text':
}
/**
- * Given a custom field value, its id and the set of options
- * find the display value for this field
+ * Find the display value for this field.
*
* @param mixed $value
* The custom field value.
* @param mixed $value
* If passed - dont fetch value from db,.
* just format the given value
- *
*/
public static function setProfileDefaults(
$customFieldId,
}
/**
- * @param int $contactID
- * @param int $cfID
- * @param int $fileID
- * @param bool $absolute
+ * Get file url.
*
- * @return array
- */
- /**
* @param int $contactID
* @param int $cfID
* @param int $fileID
}
/**
+ * Get default custom table schema.
+ *
* @param array $params
*
* @return array
*/
- public static function &defaultCustomTableSchema(&$params) {
+ public static function defaultCustomTableSchema($params) {
// add the id and extends_id
$table = array(
'name' => $params['name'],
}
/**
- * @param $field
- * @param $operation
+ * Create custom field.
+ *
+ * @param CRM_Core_DAO_CustomField $field
+ * @param string $operation
* @param bool $indexExist
* @param bool $triggerRebuild
*/
}
/**
- * Move a custom data field from one group (table) to another
+ * Move a custom data field from one group (table) to another.
*
* @param int $fieldID
* FK to civicrm_custom_field.
* @param int $newGroupID
* FK to civicrm_custom_group.
- *
- * @return void
*/
public static function moveField($fieldID, $newGroupID) {
$validation = self::_moveFieldValidate($fieldID, $newGroupID);
* Get custom option groups.
*
* @param array $includeFieldIds
- * Ids of custom fields for which.
- * option groups must be included.
+ * Ids of custom fields for which option groups must be included.
*
* Currently this is required in the cases where option groups are to be included
* for inactive fields : CRM-5369
*
- *
* @return mixed
*/
- public static function &customOptionGroup($includeFieldIds = NULL) {
+ public static function customOptionGroup($includeFieldIds = NULL) {
static $customOptionGroup = NULL;
$cacheKey = (empty($includeFieldIds)) ? 'onlyActive' : 'force';
* Custom field id.
* @param int $optionGroupId
* Option group id.
- *
- * @return void
*/
public static function fixOptionGroups($customFieldId, $optionGroupId) {
// check if option group belongs to any custom Field else delete
}
/**
- * Check if option group is related to more than one
- * custom field
+ * Check if option group is related to more than one custom field.
*
* @param int $optionGroupId
* Option group id.
- *
- * @return void
*/
public static function checkOptionGroup($optionGroupId) {
$query = "
}
/**
+ * Get option group default.
+ *
* @param int $optionGroupId
- * @param $htmlType
+ * @param string $htmlType
*
* @return null|string
*/
}
/**
+ * Post process function.
+ *
* @param array $params
* @param int $entityID
- * @param $customFieldExtends
+ * @param string $customFieldExtends
* @param bool $inline
*
* @return array
}
/**
- * @param $field
- * @param $options
+ * Build option.
+ *
+ * @param array $field
+ * @param array $options
*
* @throws Exception
*/
}
/**
- * @param $fieldLabel
+ * Get custom field ID.
+ *
+ * @param string $fieldLabel
* @param null $groupTitle
*
- * @return null
+ * @return int|null
*/
public static function getCustomFieldID($fieldLabel, $groupTitle = NULL) {
$params = array(1 => array($fieldLabel, 'String'));
}
/**
+ * Is this field a multi record field.
+ *
* @param int $customId
*
* @return bool
/**
* Does this field store a serialized string?
- * @param CRM_Core_DAO_CustomField|array $field
+ *
+ * @param array $field
+ *
* @return bool
*/
public static function isSerialized($field) {
}
/**
+ * Get options for field.
+ *
* @param array $field
* @param string|null $optionGroupName
*/