function views_taxonomy_set_breadcrumb in Views (for Drupal 7) 8.3
Same name and namespace in other branches
- 6.3 modules/taxonomy.views.inc \views_taxonomy_set_breadcrumb()
- 6.2 modules/taxonomy.views.inc \views_taxonomy_set_breadcrumb()
- 7.3 modules/taxonomy.views.inc \views_taxonomy_set_breadcrumb()
Helper function to set a breadcrumb for taxonomy.
2 calls to views_taxonomy_set_breadcrumb()
- IndexTid::set_breadcrumb in lib/
Views/ taxonomy/ Plugin/ views/ argument/ IndexTid.php - Give an argument the opportunity to modify the breadcrumb, if it wants. This only gets called on displays where a breadcrumb is actually used.
- IndexTidDepth::set_breadcrumb in lib/
Views/ taxonomy/ Plugin/ views/ argument/ IndexTidDepth.php - Give an argument the opportunity to modify the breadcrumb, if it wants. This only gets called on displays where a breadcrumb is actually used.
File
- modules/
taxonomy.views.inc, line 479 - Provide views data and handlers for taxonomy.module.
Code
function views_taxonomy_set_breadcrumb(&$breadcrumb, &$argument) {
if (empty($argument->options['set_breadcrumb'])) {
return;
}
$args = $argument->view->args;
$parents = taxonomy_get_parents_all($argument->argument);
foreach (array_reverse($parents) as $parent) {
// Unfortunately parents includes the current argument. Skip.
if ($parent->tid == $argument->argument) {
continue;
}
if (!empty($argument->options['use_taxonomy_term_path'])) {
$path = taxonomy_term_uri($parent);
$path = $path['path'];
}
else {
$args[$argument->position] = $parent->tid;
$path = $argument->view
->getUrl($args);
}
$breadcrumb[$path] = check_plain($parent->name);
}
}