You are here

function phone_field_formatter in Phone 5

Same name and namespace in other branches
  1. 6 phone.module \phone_field_formatter()

Implementation of hook_field_formatter().

File

./phone.module, line 95
Defines phone number fields for CCK. Provide some verifications on the phone numbers

Code

function phone_field_formatter($field, $item, $formatter, $node) {
  if (!isset($item['value'])) {
    return '';
  }
  if ($field['text_processing']) {
    $text = check_markup($item['value'], $item['format'], is_null($node) || isset($node->in_preview));
  }
  else {
    $text = check_plain($item['value']);
  }

  // iPhone Support
  if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== FALSE) {
    $text = '<a href="tel:' . $text . '">' . $text . '</a>';
  }
  return $text;
}