You are here

function _i18ntaxonomy_vocabulary_terms in Internationalization 5.3

Same name and namespace in other branches
  1. 5 contrib/i18ntaxonomy.module \_i18ntaxonomy_vocabulary_terms()
  2. 5.2 contrib/i18ntaxonomy.module \_i18ntaxonomy_vocabulary_terms()
1 call to _i18ntaxonomy_vocabulary_terms()
i18ntaxonomy_form_alter in contrib/i18ntaxonomy.module
Implementation of hook_form_alter().

File

contrib/i18ntaxonomy.module, line 238
Internationalization (i18n) package - taxonomy term translation

Code

function _i18ntaxonomy_vocabulary_terms($vid = NULL, $fullname = TRUE) {
  $tids = array();
  if (is_numeric($vid)) {
    $where = "WHERE td.vid = {$vid}";
  }
  elseif (is_array($vid)) {
    $where = "WHERE td.vid IN(" . implode(',', $vid) . ')';
  }
  $result = db_query("SELECT DISTINCT(td.tid), td.name, td.weight, v.name as vocabname, v.weight FROM {term_data} td LEFT JOIN {vocabulary} v ON v.vid = td.vid {$where} ORDER BY v.weight, v.name, td.weight, td.name");
  while ($obj = db_fetch_object($result)) {
    $tids[$obj->tid] = $fullname ? tt("taxonomy:vocabulary:{$obj->vid}:name", $obj->vocabname) . ': ' . tt("taxonomy:term:{$obj->tid}:name", $obj->name) : tt("taxonomy:term:{$obj->tid}:name", $obj->name);
  }
  return $tids;
}