You are here

public function RedhenContact::hasEmail in RedHen CRM 7

Determine if contact has a given email.

Parameters

string $email: Email to look for.

Return value

bool Whether or not an email exists for a contact.

File

modules/redhen_contact/lib/redhen_contact.entity.inc, line 138
Redhen Contact entity classses.

Class

RedhenContact
The class used for contact entities.

Code

public function hasEmail($email) {
  if (!empty($this->{REDHEN_CONTACT_EMAIL_FIELD})) {
    foreach ($this->{REDHEN_CONTACT_EMAIL_FIELD}[LANGUAGE_NONE] as $contact_email) {
      if ($contact_email['value'] === $email) {
        return TRUE;
      }
    }
  }
  return FALSE;
}