You are here

function faq_view_child_category_headers in Frequently Asked Questions 5.2

Same name and namespace in other branches
  1. 6 faq.module \faq_view_child_category_headers()
  2. 7.2 faq.module \faq_view_child_category_headers()
  3. 7 faq.module \faq_view_child_category_headers()

Helper function to setup the list of sub-categories for the header.

Parameters

$term: The term to setup the list of child terms for.

$faq_count: Boolean value controlling whether the number of faq nodes in a category should be displayed or not.

Return value

An array of sub-categories.

1 call to faq_view_child_category_headers()
theme_faq_category_header in ./faq.module
Theme function for formatting the faq category headers.

File

./faq.module, line 1767
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_view_child_category_headers($term, $faq_count) {
  $list = taxonomy_get_children($term->tid);
  $child_categories = array();
  foreach ($list as $tid => $child_term) {
    $term_node_count = taxonomy_term_count_nodes($child_term->tid, 'faq');
    if ($term_node_count) {

      // Get taxonomy image.
      $term_image = '';
      if (module_exists('taxonomy_image')) {
        $term_image = taxonomy_image_display($child_term->tid, array(
          'class' => 'faq-tax-image',
        ));
      }

      // Configure child term description.
      $child_term_desc = theme('faq_category_description', check_markup($child_term->description));

      // Configure child term header.
      $child_categories[] = theme('faq_child_category_header', $child_term, $term_image, $child_term_desc, $faq_count, $term_node_count);
    }
  }
  return $child_categories;
}