This module introduces a form element and a field widget which provide a flexible way for choosing an item from an hierarchy. It is based on a jQuery component http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm
Form element is created just like any other element but 'tree_select_dropdown' type is used:
$form['test-element'] = array(
'#type' => 'tree_select_dropdown',
'#mcdropdown_options' => array(), // An hierarchical nested array with all options, see format below.
'#mcdropdown' => array(...), // An array with all mcdropdown settings. See description below.
);
A field widget is called 'Tree select' and could be chosen for Taxonomy Term Reference field. Other fields are not supported now.
ATTENTION: Field widget doesn't work in a multiple mode now.
Example :
$form['test_element'] = array(
'#type' => 'tree_select_dropdown',
'#mcdropdown_options' => array(
"label" => "",
"children" => array(
1 => array(
"label" => "Box 1",
"children" => array(
2 => array(
"label" => "Box 1.1",
"children" => array(
3 => array(
"label" => "Box 1.1.1",
"children" => array(),
),
4 => array(
"label" => "Box 1.1.2",
"children" => array(),