You are here

function theme_phone_tel in Phone 7.2

Returns HTML for a tel form element.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #size, #maxlength, #placeholder, #required, #attributes, #autocomplete_path.
1 theme call to theme_phone_tel()
_phone_element_info in includes/phone.element.inc
Implements hook_element_info().

File

includes/phone.element.inc, line 258
Provides FAPI implementation for a phone element.

Code

function theme_phone_tel($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'tel';
  element_set_attributes($element, array(
    'id',
    'name',
    'value',
    'size',
    'maxlength',
    'placeholder',
  ));
  _form_set_class($element, array(
    'form-phone-tel',
  ));
  _form_set_class($element, array(
    'form-text',
  ));
  $extra = '';
  if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
    drupal_add_library('system', 'drupal.autocomplete');
    $element['#attributes']['class'][] = 'form-autocomplete';
    $attributes = array();
    $attributes['type'] = 'hidden';
    $attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
    $attributes['value'] = url($element['#autocomplete_path'], array(
      'absolute' => TRUE,
    ));
    $attributes['disabled'] = 'disabled';
    $attributes['class'][] = 'autocomplete';
    $extra = '<input' . drupal_attributes($attributes) . ' />';
  }
  $output = '<input' . drupal_attributes($element['#attributes']) . ' />';
  return $output . $extra;
}