taxonomy_get_synonyms

5 taxonomy.module taxonomy_get_synonyms($tid)
6 taxonomy.module taxonomy_get_synonyms($tid)

Return an array of synonyms of the given term ID.

1 call to taxonomy_get_synonyms()

File

modules/taxonomy/taxonomy.module, line 928
Enables the organization of content into categories.

Code

function taxonomy_get_synonyms($tid) {
  if ($tid) {
    $synonyms = array();
    $result = db_query('SELECT name FROM {term_synonym} WHERE tid = %d', $tid);
    while ($synonym = db_fetch_array($result)) {
      $synonyms[] = $synonym['name'];
    }
    return $synonyms;
  }
  else {
    return array();
  }
}

Comments

Sort order

Bear in mind that there is no concept of sort order for synonyms - so although the synonyms may have been input in a particular order in the text area on the form this API function may extract the terms in a different order.

Login or register to post comments