1 email.module email_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display)

Implements hook_field_formatter_view().

File

core/modules/email/email.module, line 76
Module file for the email module, which creates a email address field.

Code

function email_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'email_default':
      foreach ($items as $delta => $item) {
        $output = l($item['email'], 'mailto:' . $item['email']);
        $element[$delta] = array('#markup' => $output);
      }
      break;

    case 'email_plain':
      foreach ($items as $delta => $item) {
        $element[$delta] = array('#markup' => check_plain($item['email']));
      }
      break;

  }
  return $element;
}