You are here

function commerce_kickstart_taxonomy_term_path in Commerce Kickstart 7.2

Callback for hook_taxonomy_menu_path().

2 string references to 'commerce_kickstart_taxonomy_term_path'
commerce_kickstart_update_7205 in ./commerce_kickstart.install
Replace the collection view by a view based on the product display index.
_commerce_kickstart_taxonomy_menu in ./commerce_kickstart.install_callbacks.inc
BatchAPI callback.

File

modules/commerce_kickstart/commerce_kickstart_taxonomy/commerce_kickstart_taxonomy.module, line 89

Code

function commerce_kickstart_taxonomy_term_path($vid, $tid) {
  $vocabulary = taxonomy_vocabulary_load($vid);
  if ($vocabulary) {

    // 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 = $vocabulary->machine_name . '/' . $end;
    }
    else {
      $path = $vocabulary->machine_name . '/' . $tid;
      if (variable_get(_taxonomy_menu_build_variable('display_descendants', $vid), FALSE)) {

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

          // we wait to run this instead of during 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;
  }
  else {
    return taxonomy_menu_path_default($vid, $tid);
  }
}