* @static
*/
static function create(&$params) {
- if (!isset($params['id']) && !isset($params['column_name'])) {
- // if add mode & column_name not present, calculate it.
- $columnName = strtolower(CRM_Utils_String::munge($params['label'], '_', 32));
-
- $params['name'] = CRM_Utils_String::munge($params['label'], '_', 64);
+ if (!isset($params['id'])) {
+ if (!isset($params['column_name'])) {
+ // if add mode & column_name not present, calculate it.
+ $params['column_name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 32));
+ }
+ if (!isset($params['name'])) {
+ $params['name'] = CRM_Utils_String::munge($params['label'], '_', 64);
+ }
}
- elseif (isset($params['id'])) {
- $columnName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
+ else {
+ $params['column_name'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
$params['id'],
'column_name'
);