function faq_taxonomy_term_children in Frequently Asked Questions 7.2
Same name and namespace in other branches
- 7 faq.module \faq_taxonomy_term_children()
Helper function to faq_taxonomy_term_count_nodes() to return list of child terms.
1 call to faq_taxonomy_term_children()
- faq_taxonomy_term_count_nodes in ./
faq.module - Count number of nodes for a term and its children.
File
- ./
faq.module, line 1580 - The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.
Code
function faq_taxonomy_term_children($tid) {
static $children;
if (!isset($children)) {
$result = db_select('taxonomy_term_hierarchy', 'tth')
->fields('tth', array(
'parent',
'tid',
))
->execute();
while ($term = $result
->fetch()) {
$children[$term->parent][] = $term->tid;
}
}
return isset($children[$tid]) ? $children[$tid] : array();
}