function taxonomy_manager_get_partial_tree in Taxonomy Manager 7
Same name and namespace in other branches
- 6.2 taxonomy_manager.module \taxonomy_manager_get_partial_tree()
returns partial tree for a given path
1 call to taxonomy_manager_get_partial_tree()
- _taxonomy_manager_tree_get_first_path in ./
taxonomy_manager.module - calculates a path to a certain term and merges it into the tree
File
- ./
taxonomy_manager.module, line 547 - Taxonomy Manager
Code
function taxonomy_manager_get_partial_tree($path, $depth = 0) {
$tree = array();
$root_term = $path[$depth];
$children = taxonomy_get_children($root_term->tid);
if (isset($path[++$depth])) {
$next_term = $path[$depth];
}
foreach ($children as $key => $child) {
$child->depth = $depth;
$child->parents = array(
0 => $root_term->tid,
);
$tree[] = $child;
if (isset($next_term) && $child->tid == $next_term->tid) {
$tree = array_merge($tree, taxonomy_manager_get_partial_tree($path, $depth));
}
}
return $tree;
}