function _hierarchical_select_process_render_hs_selects in Hierarchical Select 5.3
Same name and namespace in other branches
- 6.3 hierarchical_select.module \_hierarchical_select_process_render_hs_selects()
Render the selects in the hierarchical select.
Parameters
$hsid: A hierarchical select id.
$hierarchy: A hierarchy object.
Return value
A structured array for use in the Forms API.
1 call to _hierarchical_select_process_render_hs_selects()
- hierarchical_select_process in ./
hierarchical_select.module - Hierarchical select form element type #process callback.
File
- ./
hierarchical_select.module, line 990 - 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 _hierarchical_select_process_render_hs_selects($hsid, $hierarchy) {
$form['#tree'] = TRUE;
$form['#prefix'] = '<div class="selects">';
$form['#suffix'] = '</div>';
foreach ($hierarchy->lineage as $depth => $selected_item) {
$form[$depth] = array(
'#type' => 'select',
'#options' => $hierarchy->levels[$depth],
'#default_value' => $selected_item,
// We need to skip the check of valid options, because they may be
// modified after each update.
'#DANGEROUS_SKIP_CHECK' => TRUE,
// Use a #theme callback to prevent the select from being wrapped in a
// div. This simplifies the CSS and JS code. Also sets a special class
// on the level label option, if any, to make level label styles
// possible.
'#theme' => 'hierarchical_select_select',
// Add child information. When a child has no children, its
// corresponding "option" element will be marked as such.
'#childinfo' => $hierarchy->childinfo[$depth],
);
}
return $form;
}