function tvi_get_breadcrumb in Taxonomy Views Integrator 7
Same name and namespace in other branches
- 6 tvi.module \tvi_get_breadcrumb()
Get the taxonomy page breadcrumb links.
This is based off of the code for [ $views->get_breadcrumb() ].
We needed a few modifications and the ability to use views by default, but allow for theme overrides of the breadcrumb trail for this module.
We also filter out links to the current override display page, so that we do not get duplicate links, when the view path matches the current taxonomy override display path.
This also allows us to have view hierarchy in our breadcrumb, instead of the typical taxonomy breadcrumb that starts with Home, then lists the terms.
So for example, we might have something like this:
Home >> Vocab >> Parent term >> This term
Parameters
object $term: The term object.
object $view: The views definition object.
Return value
array The breadcrumb related to the given term.
1 call to tvi_get_breadcrumb()
- theme_tvi_breadcrumb in ./
tvi.module - Return the taxonomy page breadcrumb (for active view overrides).
File
- ./
tvi.module, line 440 - Allow to define views to be used instead of default drupal behavior on taxonomy terms pages.
Code
function tvi_get_breadcrumb($term, $view) {
$breadcrumb = array();
if (!empty($view->build_info['breadcrumb'])) {
$curr_path = $view
->get_url(array(
$term->tid,
));
$base = TRUE;
foreach ($view->build_info['breadcrumb'] as $path => $title) {
// Check to see if the frontpage is in the breadcrumb trail; if it
// is, we'll remove that from the actual breadcrumb later.
if ($path == variable_get('site_frontpage', 'node')) {
$base = FALSE;
$title = t('Home');
}
if ($title && $path != $curr_path) {
$breadcrumb[] = l($title, $path, array(
'html' => TRUE,
));
}
}
if ($base) {
$breadcrumb = array_merge(drupal_get_breadcrumb(), $breadcrumb);
}
}
return $breadcrumb;
}