function nodeorder_orderable_tids in Node Order 7
Same name and namespace in other branches
- 5 nodeorder.module \nodeorder_orderable_tids()
- 6 nodeorder.module \nodeorder_orderable_tids()
Returns an array of the node's tids that are in orderable vocabularies.
2 calls to nodeorder_orderable_tids()
- nodeorder_node_insert in ./
nodeorder.module - Implements hook_node_insert().
- nodeorder_node_update in ./
nodeorder.module - Implements hook_node_update().
File
- ./
nodeorder.module, line 624 - Nodeorder module.
Code
function nodeorder_orderable_tids($node, $reset = FALSE) {
$tids = array();
$orderable_tids = array();
$cid = 'nodeorder:orderable_tids:' . $node->type;
if (!$reset && ($cache = cache_get($cid)) && !empty($cache->data)) {
$orderable_tids = $cache->data;
}
else {
$query = db_select('taxonomy_index', 'i');
$query
->join('taxonomy_term_data', 'd', 'd.tid = i.tid');
$query
->join('taxonomy_vocabulary', 'v', 'v.vid = d.vid');
$query
->condition('i.nid', $node->nid)
->condition('v.module', 'nodeorder')
->fields('i', array(
'tid',
));
$tids = $query
->execute()
->fetchCol('tid');
// Permanently cache the value for easy reuse.
cache_set($cid, $tids, 'cache');
}
return $tids;
}