function theme_phonefield_formatter_phonefield_default in Phone Field 7
Theme function for 'default' text field formatter.
File
- ./
phonefield.module, line 428 - Hooks for a module that defines a simple phone number field type.
Code
function theme_phonefield_formatter_phonefield_default($vars) {
$element = $vars['element'];
$linklabel = _phonefield_linklabel($element['linklabel'], $vars['field']['settings']);
$telsupport = _phonefield_tel_support();
// Display a link if both link label and phone number are available.
if (!empty($linklabel) && !empty($element['phonenumber'])) {
if ($telsupport) {
$href = 'tel:' . phonefield_normalize($element['phonenumber']);
$url = t('<a href="!href">@label</a>', array(
'!href' => $href,
'@label' => $linklabel,
));
return $url;
}
else {
return t('@prefix: @phone', array(
'@prefix' => $linklabel,
'@phone' => $element['phonenumber'],
));
}
}
elseif (!empty($linklabel)) {
return t('@label', array(
'@label' => $linklabel,
));
}
elseif (!empty($element['phonenumber'])) {
if ($telsupport) {
$href = 'tel:' . phonefield_normalize($element['phonenumber']);
$url = t('<a href="!href">@label</a>', array(
'!href' => $href,
'@label' => $element['phonenumber'],
));
return $url;
}
else {
return check_plain($element['phonenumber']);
}
}
else {
return t('no phone');
}
}