You are here

function _taxonomy_menu_get_term_breadcrumb_items in Taxonomy menu 5

Generates location items for specifyed term and parent terms

Parameters

Number. Term identificator.:

Array. Base path for term (vocabulary path).:

1 call to _taxonomy_menu_get_term_breadcrumb_items()
_taxonomy_menu_node_view in ./taxonomy_menu.inc
Generates the breadcumb for nodes that have a category listed as a menu

File

./taxonomy_menu.inc, line 256
taxonomy_menu.inc @author Jonathan Chaffer <jchaffer@structureinteractive.com> @author Bruno Massa <http://drupal.org/user/67164> It Generates menu links for all taxonomy terms

Code

function _taxonomy_menu_get_term_breadcrumb_items($tid, $path) {
  $tree = taxonomy_get_tree(taxonomy_get_term($tid)->vid);
  foreach ($tree as $term_node) {
    if ($term_node->tid == $tid) {
      $parent_items = array();
      if ($term_node->parents[0] != 0) {
        $parent_items = _taxonomy_menu_get_term_breadcrumb_items($term_node->parents[0], $path);
        $parent = end($parent_items);
        $path = $parent['path'];
      }
      array_push($parent_items, array(
        'path' => $path . '/' . $term_node->tid,
        'title' => t($term_node->name),
      ));
      return $parent_items;
    }
  }
}