You are here

function theme_faq_category_header in Frequently Asked Questions 5.2

Theme function for formatting the faq category headers.

Parameters

$term: The term which a header should be generated for.

$term_image: HTML output containing any taxonomy images attached to the taxonomy term.

$display_header: Set if the header will be shown or not.

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

$show_term_page_children: Boolean value controlling if sub-categories should be displayed on FAQ category pages.

$hide_child_terms: If true, sub-categories are only shown when parent category is selected.

$category_display: The layout of categories which should be used.

$class: Optional class name to assign the header div; overrides the default.

4 theme calls to theme_faq_category_header()
theme_faq_category_hide_answer in includes/faq.hide_answer.inc
Create the code of the FAQ page if set to show/hide the category-sorted answers when the question is clicked.
theme_faq_category_new_page in includes/faq.new_page.inc
Create the code of the FAQ page if set to show the answer in a new page when the category-sorted question is clicked.
theme_faq_category_questions_inline in includes/faq.questions_inline.inc
Create the code of the FAQ page if set to show/hide the category-sorted questions inline.
theme_faq_category_questions_top in includes/faq.questions_top.inc
Create the layout of the FAQ page if set to show the questions on top, all sorted by categories.

File

./faq.module, line 1651
The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.

Code

function theme_faq_category_header($term, $term_image, $display_header, $faq_count, $show_term_page_children, $hide_child_terms, $category_display, $class = "faq-category-group") {

  // Configure header.
  $hdr = "h5";
  if ($term->depth > 0) {
    $hdr = "h6";
  }
  $header = $term_image;
  $header .= "<{$hdr} class=\"faq-header\">";
  if ($category_display == 'hide_qa') {
    $header .= l($term->name, "faq/{$term->tid}");
  }
  else {
    $header .= check_plain($term->name);
  }
  if ($faq_count) {
    $header .= " (%%FAQ_COUNT%%)";
  }
  $header .= '</' . $hdr . ">\n";

  // #298153 - separated out for Dreamweaver bug.
  // Configure category description.
  $desc = theme('faq_category_description', check_markup($term->description));

  // Get list of sub-categories if necessary.
  $child_terms = '';
  if (($show_term_page_children || $hide_child_terms) && $category_display == 'new_page') {
    $child_categories = faq_view_child_category_headers($term, $faq_count);
    $list_style = variable_get('faq_category_listing', 'ul');
    $child_terms .= theme('item_list', $child_categories, NULL, $list_style, array(
      "class" => "faq-category-list",
    ));
  }
  $output = '<div class="' . $class . '">' . "\n";
  if ($display_header == 1) {
    $output .= '<div class="faq-qa-header">' . $header . $desc . "</div>\n";
  }
  elseif (!empty($term_image) || !empty($desc)) {
    $output .= '<div class="faq-qa-header">' . $term_image . $desc . "</div>\n";
  }
  $output .= $child_terms;
  return $output;
}