You are here

function ctools_term_breadcrumb in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/arguments/term.inc \ctools_term_breadcrumb()

Inject the breadcrumb trail if necessary.

1 string reference to 'ctools_term_breadcrumb'
term.inc in plugins/arguments/term.inc
Plugin to provide an argument handler for a Taxonomy term.

File

plugins/arguments/term.inc, line 170
Plugin to provide an argument handler for a Taxonomy term.

Code

function ctools_term_breadcrumb($conf, $context) {
  if (empty($conf['breadcrumb']) || empty($context->data) || empty($context->data->tid)) {
    return;
  }
  $breadcrumb = array();
  $current = new stdClass();
  $current->tid = $context->data->tid;
  while ($parents = taxonomy_get_parents($current->tid)) {
    $current = array_shift($parents);
    $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid);
  }
  $breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb));
  drupal_set_breadcrumb($breadcrumb);
}