function taxonomy_menu_term_count_nodes in Taxonomy menu 7
Same name and namespace in other branches
- 8 taxonomy_menu.module \taxonomy_menu_term_count_nodes()
- 7.2 taxonomy_menu.module \taxonomy_menu_term_count_nodes()
Calculates the number of nodes linked to the term and all children.
Parameters
int $tid: Taxonomy term ID.
int $vid: Vocabulary ID.
Return value
int Count for how many nodes are in that taxonomy category.
2 calls to taxonomy_menu_term_count_nodes()
- taxonomy_menu_translated_menu_link_alter in ./
taxonomy_menu.module - Implements hook_translated_menu_link_alter().
- _taxonomy_menu_item in ./
taxonomy_menu.module - Helper function: Inserts and updates menu along with taxonomy changes.
File
- ./
taxonomy_menu.module, line 1015 - Adds links to taxonomy terms into a menu.
Code
function taxonomy_menu_term_count_nodes($tid, $vid, $count = 0) {
$count += _taxonomy_menu_term_count($tid);
$children = taxonomy_get_children($tid, $vid);
foreach ($children as $tid => $term) {
$count = taxonomy_menu_term_count_nodes($term->tid, $term->vid, $count);
}
return $count;
}