You are here

function hs_taxonomy_hierarchical_select_item_get_label in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 5.3 modules/hs_taxonomy.module \hs_taxonomy_hierarchical_select_item_get_label()
  2. 7.3 modules/hs_taxonomy.module \hs_taxonomy_hierarchical_select_item_get_label()

Implementation of hook_hierarchical_select_item_get_label().

2 calls to hs_taxonomy_hierarchical_select_item_get_label()
hs_content_taxonomy_hierarchical_select_item_get_label in modules/hs_content_taxonomy.module
Implementation of hook_hierarchical_select_item_get_label().
hs_taxonomy_views_hierarchical_select_item_get_label in modules/hs_taxonomy_views.module
Implementation of hook_hierarchical_select_item_get_label().

File

modules/hs_taxonomy.module, line 500
Implementation of the Hierarchical Select API for the Taxonomy module.

Code

function hs_taxonomy_hierarchical_select_item_get_label($item, $params) {
  static $labels = array();
  if (!isset($labels[$item])) {
    $term = taxonomy_get_term($item);

    // Use the translated term when available!
    if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary($term->vid) == I18N_TAXONOMY_LOCALIZE) {
      $labels[$item] = tt("taxonomy:term:{$term->tid}:name", $term->name);
    }
    else {
      $labels[$item] = t($term->name);
    }
  }
  return $labels[$item];
}