function email_field_validate

cis7 email.module email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors)
cle7 email.module email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors)
elmsmedia7 email.module email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors)
icor7 email.module email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors)
meedjum_blog7 email.module email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors)
mooc7 email.module email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors)

Implements hook_field_validate().

Possible error codes:

  • 'email_invalid': The email address is not valid

File

sites/all/modules/ulmus/email/email.module, line 39
Module file for the email module, which creates a email address field.

Code

function email_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {
    if ($item['email'] != '' && !valid_email_address(trim($item['email']))) {
      $message = t('"%mail" is not a valid email address', array('%mail' => $item['email']));
      $errors[$field['field_name']][$langcode][$delta][] = array(
        'error' => "email_invalid",
        'message' => $message,
      );
    }
  }
}