You are here

function theme_webform_display_phonefield in Webform Phone Number 7

Same name and namespace in other branches
  1. 7.2 webform_phone.components.inc \theme_webform_display_phonefield()

Format the output of data for this component.

1 theme call to theme_webform_display_phonefield()
_webform_display_phone in ./webform_phone.components.inc
Display the result of a submission for a component. The output of this function will be displayed under the "Results" tab then "Submissions". This should output the saved data in some reasonable manner.

File

./webform_phone.components.inc, line 288
Webform Component information for a phone number field type

Code

function theme_webform_display_phonefield($variables) {
  $element = $variables['element'];
  $plain_value = check_plain($element['#value']);
  if ($element['#format'] == 'html') {

    //Use smarter detection if available for formatting the output
    $is_mobile_device = module_exists('mobile_tools') ? mobile_tools_is_mobile_device() : strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== FALSE || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== FALSE;
    $value = $is_mobile_device ? '<a href="tel:' . $plain_value . '">' . $plain_value . '</a>' : $plain_value;
  }
  else {
    $value = $plain_value;
  }
  return $value;
}