You are here

function theme_cck_phone_formatter_local in Phone Number 6

Theme function for 'local' phone number field formatter.

File

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

Code

function theme_cck_phone_formatter_local($element) {
  $item = $element['#item'];
  $phone = '';

  // Display a local phone number without country code.
  if (!empty($item['number'])) {

    // Call country local formatter if exist
    $function = $item['country_codes'] . '_formatter_local';
    if (function_exists($function)) {
      $phone = $function($element);
    }

    // Output a raw value if no custom formatter or formatter return empty
    if (empty($phone)) {
      $phone = $item['number'];
    }

    // Extension
    if (!empty($item['extension'])) {
      $phone = $phone . theme('phone_number_extension', $item['extension']);
    }

    // Mobile browsers support
    $phone = theme('cck_phone_mobile_tel', $element, $phone);
  }
  return $phone;
}