function select_with_style_build_term_tree in Select with Style 7
Build a tree from the supplied terms.
Parameters
array $terms:
array $term_tree:
int $i_start:
int $parent_tid:
2 calls to select_with_style_build_term_tree()
- select_with_style_assemble_optgroups_options_and_attributes in select_with_style/
select_with_style.module - Returns a linear list of attributes to go with an optgroup list of options.
- select_with_style_assemble_tree_options_and_attributes in select_with_style/
select_with_style.module - Returns a linear list of options, with may be styled like a tree using the also returned option attributes.
File
- select_with_style/
select_with_style.module, line 440 - select_with_style.module
Code
function select_with_style_build_term_tree($terms, &$term_tree, $i_start = 0, $parent_tid = 0) {
$num_terms = count($terms);
for ($i = $i_start; $i < $num_terms; $i++) {
$term = $terms[$i];
if ($parent_tid == reset($term->parents)) {
$term_tree[$term->tid] = array();
select_with_style_build_term_tree($terms, $term_tree[$term->tid], $i + 1, $term->tid);
}
}
}