function taxonomy_menu_block_nest_tree in Taxonomy menu block 7
Nest tree.
1 call to taxonomy_menu_block_nest_tree()
- taxonomy_menu_block_build in ./
taxonomy_menu_block.module - Function to build our tree.
File
- ./
taxonomy_menu_block.module, line 782 - Taxonomy Menu Block module allows you to make menu blocks out of your taxonomies in a very performant way.
Code
function taxonomy_menu_block_nest_tree($tree, $root = '0') {
$nested_tree = array();
// Loop over the tree and search for direct children of the root.
foreach ($tree as $tid => $term) {
// Direct child is found.
if ($term['parents'][0] == $root) {
// Remove item from tree (we don't need to traverse this again).
unset($tree[$tid]);
// Append the child into result array and parse its children.
$nested_tree[$tid] = $term;
$nested_tree[$tid]['children'] = taxonomy_menu_block_nest_tree($tree, $tid);
}
}
return $nested_tree;
}