You are here

function theme_select_or_other in Select (or other) 6.2

Same name and namespace in other branches
  1. 6 select_or_other.module \theme_select_or_other()
  2. 7.3 select_or_other.module \theme_select_or_other()
  3. 7.2 select_or_other.module \theme_select_or_other()

Theme a Select (or other) element.

1 theme call to theme_select_or_other()
select_or_other_elements in ./select_or_other.module
Implementation of hook_elements().

File

./select_or_other.module, line 29
The Select (or other) module.

Code

function theme_select_or_other($element) {

  // Load the JS file to hide/show the 'other' box when needed.
  drupal_add_js(drupal_get_path('module', 'select_or_other') . '/select_or_other.js');
  $output = "<div class=\"select-or-other form-item\">\n";
  $output .= drupal_render($element) . "\n";

  // Render #description below both elements.
  if (!empty($element['#description'])) {
    $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
    unset($element['#description']);
  }
  $output .= "</div>\n";
  return $output;
}