function redhen_fields_create_email_field in RedHen CRM 7
Create the redhen_email field.
1 call to redhen_fields_create_email_field()
- RedhenContactType::save in modules/
redhen_contact/ lib/ redhen_contact_type.entity.inc - Override parent save method to ensure we have an email field for each type.
File
- modules/
redhen_fields/ redhen_fields.module, line 883 - Defines email, phone and address field types for RedHen CRM.
Code
function redhen_fields_create_email_field() {
// Clear the field cache so the redhen_email type is found.
field_cache_clear();
// If the field doesn't already exist, create required email field to be used
// with contacts.
$prior_field = field_read_field(REDHEN_CONTACT_EMAIL_FIELD, array(
'include_inactive' => TRUE,
));
if (empty($prior_field)) {
$email_field = array(
'field_name' => REDHEN_CONTACT_EMAIL_FIELD,
'type' => 'redhen_email',
'locked' => FALSE,
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'labels' => array(
1 => 'home',
2 => 'work',
),
),
);
field_create_field($email_field);
}
}