function taxonomy_list_count_nodes in Taxonomy List 7
Helper function to replace taxonomy_list_count_nodes().
1 call to taxonomy_list_count_nodes()
- taxonomy_list_get_tree in ./
taxonomy_list.module - Returns tree of terms. Enhancement for taxonomy_get_tree.
File
- ./
taxonomy_list.module, line 305 - List all terms in a vocabulary.
Code
function taxonomy_list_count_nodes($tid, $type = NULL) {
$query = db_select('taxonomy_index', 'ti')
->condition('ti.tid', $tid);
if ($type) {
$query
->innerJoin('node', 'n', 'n.nid = ti.nid');
$query
->condition('n.type', $type);
// Allow access functions to grab this.
$query
->addTag('node_access');
}
return $query
->countQuery()
->execute()
->fetchField();
}