function forum_CrumbsMonoPlugin_forumTerm::findParent__forum_x in Crumbs, the Breadcrumbs suite 7
Same name and namespace in other branches
- 7.2 plugins/crumbs.forum.inc \forum_CrumbsMonoPlugin_forumTerm::findParent__forum_x()
Forums get their parent forums as breadcrumb parent. The method name matches the router path "forum/%". Forums are actually taxonomy terms, just the path is different.
File
- plugins/
crumbs.forum.inc, line 30
Class
Code
function findParent__forum_x($path, $item) {
$term = $item['map'][1];
// Load the forum term,
// if it hasn't been loaded due to a missing wildcard loader.
// We could use forum_forum_load() instead, but this looks too scary
// performance-wise, and we don't actually need it.
// So we just use taxonomy_term_load() instead.
$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) {
// The parent forum
return 'forum/' . $parent_tid;
}
}
// Forum overview
return 'forum';
}