function om_tools_taxonomy_node_get_terms in OM Tools 8
Same name and namespace in other branches
- 8.2 tools/node/node.inc \om_tools_taxonomy_node_get_terms()
- 7.2 tools/node/node.inc \om_tools_taxonomy_node_get_terms()
- 7 tools/node/node.inc \om_tools_taxonomy_node_get_terms()
1 call to om_tools_taxonomy_node_get_terms()
- om_node_preprocess_html in tools/
node/ node.inc - Override or insert om variables into the templates.
File
- tools/
node/ node.inc, line 182 - Body Classes Utility
Code
function om_tools_taxonomy_node_get_terms($node, $key = 'tid') {
static $terms;
if (!isset($terms[$node->vid][$key])) {
$query = db_select('taxonomy_index', 'r');
$t_alias = $query
->join('taxonomy_term_data', 't', 'r.tid = t.tid');
$v_alias = $query
->join('taxonomy_vocabulary', 'v', 't.vid = v.vid');
$query
->fields($t_alias);
$query
->condition("r.nid", $node->nid);
$result = $query
->execute();
$terms[$node->vid][$key] = array();
foreach ($result as $term) {
$terms[$node->vid][$key][$term->{$key}] = $term;
}
}
return $terms[$node->vid][$key];
}