You are here

function taxonomy_manager_tree_term_extra_info in Taxonomy Manager 7

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

returns some additional information about the term which gets added to the link title

3 calls to taxonomy_manager_tree_term_extra_info()
taxonomy_manager_form_submit in ./taxonomy_manager.admin.inc
submits the taxonomy manager form (only search button)
taxonomy_manager_tree_build_form in ./taxonomy_manager.module
recursive function for building nested form array with checkboxes and weight forms for each term
_taxonomy_manager_form_term_data_parents in ./taxonomy_manager.admin.inc
helper function for generating tables with values and delete op and field for adding

File

./taxonomy_manager.module, line 728
Taxonomy Manager

Code

function taxonomy_manager_tree_term_extra_info($term) {
  $extra_info = "";
  $term_children_count = _taxonomy_manager_tree_term_children_count($term->tid);
  $term_parents = taxonomy_get_parents($term->tid);
  if ($term_children_count > 0) {
    $extra_info = t('Children Count: @count', array(
      '@count' => $term_children_count,
    ));
  }
  if (count($term_parents) >= 1) {
    $extra_info .= !empty($extra_info) ? ' | ' : '';
    $extra_info .= t('Direct Parents:') . ' ';
    $p_names = array();
    foreach ($term_parents as $p) {
      if ($p->tid != $term->tid) {
        $p_names[] = $p->name;
      }
    }
    $extra_info .= implode(', ', $p_names);
  }
  if (module_exists('synonyms')) {
    $full_term = taxonomy_term_load($term->tid);
    $term_synonyms = synonyms_get_term_synonyms($full_term);
    $term_synonyms_count = sizeof($term_synonyms);
    if ($term_synonyms_count > 0) {
      $extra_info .= !empty($extra_info) ? ' | ' : '';
      $extra_info .= t('Synonyms Count: @count', array(
        '@count' => $term_synonyms_count,
      ));
    }
  }
  return $extra_info;
}