function taxonomy_CrumbsMultiPlugin_termParent::findParent__taxonomy_term_x in Crumbs, the Breadcrumbs suite 7.2
Same name and namespace in other branches
- 7 plugins/crumbs.taxonomy.inc \taxonomy_CrumbsMultiPlugin_termParent::findParent__taxonomy_term_x()
Terms get their parent terms as breadcrumb parent. The method name matches the router path "taxonomy/term/%".
Parameters
string $path:
array $item:
Return value
array
File
- plugins/
crumbs.taxonomy.inc, line 45
Class
Code
function findParent__taxonomy_term_x($path, $item) {
if (FALSE === ($term = crumbs_Util::itemExtractEntity($item, 'taxonomy_term', 2))) {
return NULL;
}
$parents = taxonomy_get_parents($term->tid);
foreach ($parents as $parent_tid => $parent_term) {
if ($parent_term->vocabulary_machine_name == $term->vocabulary_machine_name) {
$uri = entity_uri('taxonomy_term', $parent_term);
if (!empty($uri)) {
return array(
$term->vocabulary_machine_name => $uri['path'],
);
}
}
}
return NULL;
}