function _fe_taxonomy_get_terms in Features Extra 6
Get all terms for a vocabulary.
Use vid as cache key.
Only one parent, no relations, no synonyms.
File
- ./
fe_taxonomy.module, line 379
Code
function _fe_taxonomy_get_terms($vid) {
static $cache = array();
if (!isset($cache[$vid])) {
$terms = array();
$query = "SELECT data.*, hierarchy.parent" . " FROM {term_data} data" . " INNER JOIN {term_hierarchy} hierarchy ON hierarchy.tid = data.tid" . " WHERE data.vid = %d" . " ORDER BY data.name ASC";
$result = db_query($query, $vid);
while ($obj = db_fetch_object($result)) {
if (!array_key_exists($obj->tid, $terms)) {
$term = array();
$term['name'] = $obj->name;
$term['description'] = $obj->description;
$term['weight'] = $obj->weight;
$term['parent'] = array(
$obj->parent => 1,
);
$terms[$obj->tid] = $term;
}
}
$cache[$vid] = _fe_taxonomy_build_term_tree($terms);
}
return $cache[$vid];
}