function data_taxonomy_lookup_term in Data 6
Look up a term by name and vid.
Parameters
$name: Term name.
$vid: A <em>numeric</em> vocabulary id (vid).
Return value
A taxonomy term array if there is a term for $name/$vid, NULL otherwise.
2 calls to data_taxonomy_lookup_term()
- data_taxonomy_save_term_array in data_taxonomy/
data_taxonomy.module - Save a term array, create a new one if it does not exist yet.
- data_taxonomy_save_term_name in data_taxonomy/
data_taxonomy.module - Save a term, create a new one if it does not exist yet.
File
- data_taxonomy/
data_taxonomy.module, line 357 - Hooks and API functions for Data Node module.
Code
function data_taxonomy_lookup_term($name, $vid) {
static $terms;
if (!isset($terms[$vid][$name])) {
foreach (data_taxonomy_get_term_by_name_vid($name, $vid) as $term) {
if ($term->vid == $vid) {
$terms[$vid][$name] = (array) $term;
}
}
}
return isset($terms[$vid][$name]) ? $terms[$vid][$name] : NULL;
}