You are here

function redhen_fields_create_email_instance in RedHen CRM 7

Create an instance of the redhen_email field for a redhen_contact bundle.

1 call to redhen_fields_create_email_instance()
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 909
Defines email, phone and address field types for RedHen CRM.

Code

function redhen_fields_create_email_instance($bundle_name) {
  $instance = field_info_instance('redhen_contact', REDHEN_CONTACT_EMAIL_FIELD, $bundle_name);
  if (!$instance) {
    $email_field = array(
      'field_name' => REDHEN_CONTACT_EMAIL_FIELD,
      'entity_type' => 'redhen_contact',
      'bundle' => $bundle_name,
      'label' => t('Email'),
    );
    field_create_instance($email_field);
  }
}