You are here

function redhen_contact_property_email_get in RedHen CRM 7

Entity metadata property getter for default email.

Return value

string Default email address.

1 string reference to 'redhen_contact_property_email_get'
RedhenContactMetadataController::entityPropertyInfo in modules/redhen_contact/lib/redhen_contact.metadata.inc
Overrides entityPropertyInfo().

File

modules/redhen_contact/redhen_contact.module, line 1451
Module file for RedHen contacts.

Code

function redhen_contact_property_email_get(RedhenContact $contact, array $options, $property_name, $entity_type) {
  if (!empty($contact->{REDHEN_CONTACT_EMAIL_FIELD})) {
    foreach ($contact->{REDHEN_CONTACT_EMAIL_FIELD}[LANGUAGE_NONE] as $email) {
      if ($email['default']) {
        return $email['value'];
      }
    }
  }
  return '';
}