function taxonomy_CrumbsMultiPlugin_termParent::findParent__taxonomy_term_x in Crumbs, the Breadcrumbs suite 7
Same name and namespace in other branches
- 7.2 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/%".
File
- plugins/
crumbs.taxonomy.inc, line 178
Class
Code
function findParent__taxonomy_term_x($path, $item) {
$term = $item['map'][2];
// Load the term if it hasn't been loaded due to a missing wildcard loader.
$term = is_numeric($term) ? taxonomy_term_load($term) : $term;
$parents = taxonomy_get_parents($term->tid);
$result = array();
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'],
);
}
}
}
}