function views_taxonomy_set_breadcrumb

Helper function to set a breadcrumb for taxonomy.

3 calls to views_taxonomy_set_breadcrumb()
views_handler_argument_term_node_tid::set_breadcrumb in modules/taxonomy/views_handler_argument_term_node_tid.inc
Give an argument the opportunity to modify the breadcrumb, if it wants.
views_handler_argument_term_node_tid_depth::set_breadcrumb in modules/taxonomy/views_handler_argument_term_node_tid_depth.inc
Give an argument the opportunity to modify the breadcrumb, if it wants.
views_handler_argument_term_node_tid_depth_join::set_breadcrumb in modules/taxonomy/views_handler_argument_term_node_tid_depth_join.inc
Give an argument the opportunity to modify the breadcrumb, if it wants.

File

modules/taxonomy.views.inc, line 529

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
                ->get_url($args);
        }
        $breadcrumb[$path] = check_plain($parent->name);
    }
}