function taxonomy_menu_path_multiple_terms in Taxonomy menu 7.2
Same name and namespace in other branches
- 8 taxonomy_menu.module \taxonomy_menu_path_multiple_terms()
Callback for hook_taxonomy_menu_path.
File
- ./
taxonomy_menu.module, line 605 - 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->tid == 0) {
$tids = _taxonomy_menu_get_tids($term->vid);
}
else {
$tids = array(
$term->tid,
);
$terms = taxonomy_get_tree($term->vid, $term->tid);
foreach ($terms as $term) {
$tids[] = $term->tid;
}
}
// Build the path.
if ($tids) {
$path = 'taxonomy/term/' . implode('+', $tids);
}
else {
$uri = entity_uri('taxonomy_term', $term);
$path = !empty($uri['path']) ? $uri['path'] : 'taxonomy/term/' . $term->tid;
}
return $path;
}