You are here

function content_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 content_taxonomy_get_term_by_name_vid()
content_taxonomy_feeds_set_target in mappers/content_taxonomy.inc
Callback for mapping. Here is where the actual mapping happens.

File

mappers/content_taxonomy.inc, line 112
Enable the user of feeds to map taxonomy terms from the feed for the current node to content_taxonomy CCK fields.

Code

function content_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 vid=%d", 't', 'tid'), trim($name), $vid);
  $result = array();
  while ($term = db_fetch_array($db_result)) {
    $result[] = $term;
  }
  return $result;
}