You are here

function theme_phonefield_field in Phone Field 7

Formats a phonefield field widget.

1 theme call to theme_phonefield_field()
phonefield_element_info in ./phonefield.module
Implements hook_element_info().

File

./phonefield.module, line 269
Hooks for a module that defines a simple phone number field type.

Code

function theme_phonefield_field($vars) {
  $element = $vars['element'];

  // Prefix single value phonefield fields with the name of the field.
  if (empty($element['#field']['multiple'])) {
    if (isset($element['phonenumber']) && !isset($element['linklabel'])) {
      $element['phonenumber']['#title_display'] = 'invisible';
    }
  }
  $output = '';
  $output .= '<div class="phonefield-field-subrow clearfix">';
  if (isset($element['linklabel'])) {
    $output .= '<div class="phonefield-field-title phonefield-field-column">' . drupal_render($element['linklabel']) . '</div>';
  }
  $output .= '<div class="phonefield-field-phonenumber' . (isset($element['linklabel']) ? ' phonefield-field-column' : '') . '">' . drupal_render($element['phonenumber']) . '</div>';
  $output .= '</div>';
  $output .= drupal_render_children($element);
  return $output;
}