function _hierarchical_select_render_selects in Hierarchical Select 5
Render the HTML (the selects) for the given hierarchy..
Parameters
$hsid: The hierarchical select id.
$hierarchy: A hierarchy object.
Return value
The rendered HTML.
1 call to _hierarchical_select_render_selects()
- _hierarchical_select_render in ./
hierarchical_select.module - Render the hierarchical select.
File
- ./
hierarchical_select.module, line 279 - This module defines the "hierarchical_select" form element, which is a greatly enhanced way for letting the user select an option in a hierarchy. Out of the box, this module supports the taxonomy and content_taxonomy modules, but that…
Code
function _hierarchical_select_render_selects($hsid, $hierarchy) {
$output = '';
for ($depth = 0; $depth < count($hierarchy->lineage); $depth++) {
$output .= '<select id="hierarchical-select-' . $hsid . '-level-' . $depth . '" class="form-select hierarchical-select hierarchical-select-' . $hsid . '-hierarchical-select">';
foreach ($hierarchy->levels[$depth] as $value => $label) {
if ($value == $hierarchy->lineage[$depth]) {
$output .= '<option selected="selected" value="' . $value . '">' . check_plain($label) . '</option>';
}
else {
$output .= '<option value="' . $value . '">' . check_plain($label) . '</option>';
}
}
$output .= '</select>';
}
return $output;
}