You are here

function taxonomy_menu_path_default in Taxonomy menu 6.3

Same name and namespace in other branches
  1. 8 taxonomy_menu.module \taxonomy_menu_path_default()
  2. 6.2 taxonomy_menu.module \taxonomy_menu_path_default()
  3. 7.2 taxonomy_menu.module \taxonomy_menu_path_default()
  4. 7 taxonomy_menu.module \taxonomy_menu_path_default()

Callback for hook_taxonomy_menu_path

4 string references to 'taxonomy_menu_path_default'
taxonomy_menu_create_path in ./taxonomy_menu.module
Create the path for the vid/tid combination.
taxonomy_menu_get_options in ./taxonomy_menu.module
Used to create a form array of taxonomy menu options invokes hook_taxonomy_menu_options().
taxonomy_menu_schema in ./taxonomy_menu.install
Implementation of hook_schema().
taxonomy_menu_taxonomy_menu_options in ./taxonomy_menu.module
Implementation of hook_taxonomy_menu_options().

File

./taxonomy_menu.module, line 187
It Generates menu links for all selected taxonomy terms

Code

function taxonomy_menu_path_default($vid, $tid) {

  //if tid = 0 then we are creating the vocab menu item format will be taxonomy/term/$tid+$tid+$tid....
  if ($tid == 0) {

    //get all of the terms for the vocab
    $vtids = _taxonomy_menu_get_terms($vid);
    $end = implode(' ', $vtids);
    $path = "taxonomy/term/{$end}";
  }
  else {
    $path = taxonomy_term_path(taxonomy_get_term($tid));
    if (variable_get('taxonomy_menu_display_descendants_' . $vid, FALSE)) {

      //Use 'all' at the end of the path
      if (variable_get('taxonomy_menu_end_all_' . $vid, FALSE)) {
        $path .= '/all';
      }
      else {

        //we wait to run this instead of durning the if above

        //because we only wan to run it once.
        $terms = taxonomy_get_tree($vid, $tid);
        foreach ($terms as $term) {
          $tids[] = $term->tid;
        }
        if ($tids) {
          $end = implode(' ', $tids);
          $path .= ' ' . $end;
        }
      }
    }
  }
  return $path;
}