function taxonomy_menu_path_multiple_terms in Taxonomy menu 8
Same name and namespace in other branches
- 7.2 taxonomy_menu.module \taxonomy_menu_path_multiple_terms()
Callback for hook_taxonomy_menu_path.
File
- ./
taxonomy_menu.module, line 602 - Generates menu links for all selected taxonomy terms.
Code
function taxonomy_menu_path_multiple_terms($term) {
// When tid equals 0, we are dealing with a vocabulary item. We want the path
// to be a mulitple term path.
if ($term
->id() == 0) {
$tids = _taxonomy_menu_get_tids($term
->bundle());
}
else {
$tids = array(
$term
->id(),
);
$terms = taxonomy_get_tree($term
->bundle(), $term
->id());
foreach ($terms as $term) {
$tids[] = $term->tid;
}
}
// Build the path.
if ($tids) {
$path = 'taxonomy/term/' . implode('+', $tids);
}
else {
$uri = $term
->uri();
$path = !empty($uri['path']) ? $uri['path'] : 'taxonomy/term/' . $term->tid;
}
return $path;
}