You are here

function taxonomy_manager_term_page in Taxonomy Manager 5

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.module \taxonomy_manager_term_page()
  2. 6 taxonomy_manager.module \taxonomy_manager_term_page()

menu callback

replaces taxonomy_mangager_term_page, because we have to consider that the url may contain former merged terms, which no longer exists every given tid gets checked, if it has been merged. if yes, the tid gets replaced with tid of main term and afterwards passed to default taxonomy_manager_term_page

Parameters

$str_tids:

$depth:

$op:

1 string reference to 'taxonomy_manager_term_page'
taxonomy_manager_menu in ./taxonomy_manager.module
Implementation of hook_menu

File

./taxonomy_manager.module, line 1380
Taxonomy Manager

Code

function taxonomy_manager_term_page($str_tids = '', $depth = 0, $op = 'page') {
  $tids = taxonomy_terms_parse_string($str_tids);
  if ($tids['operator'] == 'and' || $tids['operator'] == 'or') {
    $new_tids = array();
    foreach ($tids['tids'] as $tid) {

      //get cached main term, if not merged, returns 0
      $main_term = taxonomy_manager_merge_get_main_term($tid);
      $new_tids[] = $main_term ? $main_term : $tid;
    }
    if ($tids['operator'] == 'and') {
      $operator = ',';
    }
    else {
      if ($tids['operator'] == 'or') {
        $operator = '+';
      }
    }
    $new_tids_str = implode($operator, $new_tids);
    return taxonomy_term_page($new_tids_str, $depth, $op);
  }
  else {
    drupal_not_found();
  }
}