function theme_hierarchical_select in Hierarchical Select 5.3
Same name and namespace in other branches
- 6.3 includes/theme.inc \theme_hierarchical_select()
- 7.3 includes/theme.inc \theme_hierarchical_select()
Format a hierarchical select.
Parameters
$element: An associative array containing the properties of the element.
Return value
A themed HTML string representing the form element.
File
- ./
hierarchical_select.module, line 2239 - This module defines the "hierarchical_select" form element, which is a greatly enhanced way for letting the user select items in a hierarchy.
Code
function theme_hierarchical_select($element) {
$output = '';
// Update $element['#attributes']['class'].
$hsid = $element['hsid']['#value'];
$level_labels_style = variable_get('hierarchical_select_level_labels_style', 'none');
$classes = array(
'hierarchical-select-wrapper',
"hierarchical-select-level-labels-style-{$level_labels_style}",
// Classes that make it possible to override the styling of specific
// instances of Hierarchical Select, based on either the ID of the form
// element or the config that it uses.
'hierarchical-select-wrapper-for-name-' . $element['#id'],
isset($element['#config']['config_id']) ? 'hierarchical-select-wrapper-for-config-' . $element['#config']['config_id'] : NULL,
);
$element['#attributes']['class'] .= ' ' . implode(' ', $classes);
$element['#attributes']['id'] = "hierarchical-select-{$hsid}-wrapper";
$element['#id'] = "hierarchical-select-{$hsid}-wrapper";
// This ensures the label's for attribute is correct.
$output .= theme('form_element', array(
'#title' => $element['#title'],
'#description' => $element['#description'],
'#id' => $element['#id'],
'#required' => $element['#required'],
'#error' => $element['#error'],
), '<div ' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</div>');
return $output;
}