You are here

function faq_view_child_category_headers in Frequently Asked Questions 7

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

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

Parameters

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

Return value

array An array of sub-categories.

4 calls to faq_view_child_category_headers()
template_preprocess_faq_category_hide_answer in includes/faq.hide_answer.inc
Create categorized FAQ page if set to show answer when question is clicked.
template_preprocess_faq_category_new_page in includes/faq.new_page.inc
Create categorized FAQ page if set to show answer in a new page.
template_preprocess_faq_category_questions_inline in includes/faq.questions_inline.inc
Create categorized FAQ page if set to show/hide the questions inline.
template_preprocess_faq_category_questions_top in includes/faq.questions_top.inc
Create categorized questions for FAQ page if set to show questions on top.

File

./faq.module, line 1454
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) {
  $child_categories = array();
  $list = taxonomy_get_children($term->tid);
  if (function_exists('i18n_taxonomy_localize_terms')) {
    $list = i18n_taxonomy_localize_terms($list);
  }
  foreach ($list as $tid => $child_term) {
    $term_node_count = faq_taxonomy_term_count_nodes($child_term->tid);
    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',
        ));
      }
      $term_vars['link'] = l(faq_tt("taxonomy:term:{$child_term->tid}:name", $child_term->name), _faq_path() . "/{$child_term->tid}");
      $term_vars['description'] = check_markup(faq_tt("taxonomy:term:{$child_term->tid}:description", $child_term->description));
      $term_vars['count'] = $term_node_count;
      $term_vars['term_image'] = $term_image;
      $child_categories[] = $term_vars;
    }
  }
  return $child_categories;
}