You are here

function taxonomy_get_term_by_name_vid in Feeds 6

Try to map a string to an existing term by name and vocabulary id.

Provides a case-insensitive and trimmed mapping, to maximize the likelihood of a successful match limited by a vocabulary id.

Parameters

$name: Name of the term to search for.

$vid: The vocabulary's ID.

Return value

An array of matching term objects.

1 call to taxonomy_get_term_by_name_vid()
taxonomy_feeds_set_target in mappers/taxonomy.inc
Callback for mapping. Here is where the actual mapping happens.

File

mappers/taxonomy.inc, line 145
Mapper that exposes a node's taxonomy vocabularies as mapping targets.

Code

function taxonomy_get_term_by_name_vid($name, $vid) {
  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s') AND t.vid = %d", 't', 'tid'), trim($name), $vid);
  $result = array();
  while ($term = db_fetch_object($db_result)) {
    $result[] = $term;
  }
  return $result;
}