function theme_phonefield_formatter_phonefield_separate_link in Phone Field 7
Theme function for 'separate_link' text field formatter.
File
- ./
phonefield.module, line 466 - Hooks for a module that defines a simple phone number field type.
Code
function theme_phonefield_formatter_phonefield_separate_link($vars) {
$element = $vars['element'];
$linklabel = _phonefield_linklabel($element['linklabel'], $vars['field']['settings']);
$telsupport = _phonefield_tel_support();
// Display label and 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('@prefix: <a href="!href">!label</a>', array(
'@prefix' => $linklabel,
'!href' => $href,
'!label' => $element['phonenumber'],
));
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');
}
}