You are here

function theme_hierarchical_select_form_element in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 7.3 includes/theme.inc \theme_hierarchical_select_form_element()

Return a themed Hierarchical Select form element.

Parameters

element: An associative array containing the properties of the element. Properties used: title, description, id, required

$value: The form element's data.

Return value

A string representing the form element.

1 theme call to theme_hierarchical_select_form_element()
theme_hierarchical_select in includes/theme.inc
Format a hierarchical select.

File

includes/theme.inc, line 27
All theme functions for the Hierarchical Select module.

Code

function theme_hierarchical_select_form_element($element, $value) {
  $output = '<div class="form-item hierarchical-select-wrapper-wrapper"';
  if (!empty($element['#id'])) {
    $output .= ' id="' . $element['#id'] . '-wrapper"';
  }
  $output .= ">\n";
  $required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';
  if (!empty($element['#title'])) {
    $title = $element['#title'];
    if (!empty($element['#id'])) {
      $output .= ' <label for="' . $element['#id'] . '">' . t('!title: !required', array(
        '!title' => filter_xss_admin($title),
        '!required' => $required,
      )) . "</label>\n";
    }
    else {
      $output .= ' <label>' . t('!title: !required', array(
        '!title' => filter_xss_admin($title),
        '!required' => $required,
      )) . "</label>\n";
    }
  }
  $output .= " {$value}\n";
  if (!empty($element['#description'])) {
    $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
  }
  $output .= "</div>\n";
  return $output;
}