You are here

function theme_barcode_textfield in Barcode 6

Same name and namespace in other branches
  1. 6.2 barcodefield.module \theme_barcode_textfield()

FAPI theme for an individual text elements.

File

./barcode.module, line 243

Code

function theme_barcode_textfield($element) {
  drupal_add_css(drupal_get_path('module', 'barcode') . '/barcode.css');

  // Prefix single value barcode fields with the name of the field.
  if (empty($element['#field']['multiple'])) {
    if (isset($element['barcode']) && isset($element['title'])) {
      $element['barcode']['#title'] = $element['#title'] . ' ' . $element['barcode']['#title'];
      $element['title']['#title'] = $element['#title'] . ' ' . $element['title']['#title'];
    }
    elseif ($element['barcode']) {
      $element['barcode']['#title'] = $element['#title'];
    }
  }
  $output = '';
  $output .= '<div class="barcode-field-subrow clear-block">';
  if (isset($element['title'])) {
    $output .= '<div class="barcode-field-title barcode-field-column">' . theme('textfield', $element['title']) . '</div>';
  }
  $output .= '<div class="barcode-field-url' . (isset($element['title']) ? ' barcode-field-column' : '') . '">' . theme('textfield', $element['barcode']) . '</div>';
  $output .= '</div>';
  return $output;
}