You are here

function theme_faq_format_question in Frequently Asked Questions 5.2

Theme function to format a question.

Parameters

$node: The node object.

$path: The path/url which the question should link to if links are disabled.

$anchor: Link anchor to use in question links; for "questions top" layout.

$question_label: The question label, if set.

$class: An additional class name to assign the div containing the question.

Return value

HTML formatted string containing the question.

7 theme calls to theme_faq_format_question()
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_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.
theme_faq_category_questions_top_answers in includes/faq.questions_top.inc
Create the layout of the answers if set to show the questions on top, all sorted by categories.
theme_faq_hide_answer in includes/faq.hide_answer.inc
Create the structure of the FAQ page if set to show/hide the answers when the question is clicked.

... See full list

File

./faq.module, line 1484
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_format_question($node, $path = NULL, $anchor = NULL, $question_label = '', $class = NULL) {
  $disable_node_links = variable_get('faq_disable_node_links', FALSE);

  // Setup the question div.
  $question = '<div class="faq-question">';
  if (!empty($class)) {
    $question = '<div class="faq-question ' . $class . '">';
  }

  // Don't link to faq node, instead provide no link, or link to current page.
  if ($disable_node_links) {
    if (empty($path) && empty($anchor)) {
      $question .= check_plain($question_label) . check_plain($node->question);
    }
    elseif (empty($path)) {
      $question .= '<a name="' . $anchor . '" id="' . $anchor . '">' . check_plain($question_label) . check_plain($node->question) . '</a>';
    }
    else {
      $question .= l($question_label . $node->question, $path);
    }
  }
  else {
    if (empty($anchor)) {
      $question .= l($question_label . $node->question, "node/{$node->nid}");
    }
    else {
      $question .= l($question_label . $node->question, "node/{$node->nid}", array(
        "name" => "{$anchor}",
        "id" => "{$anchor}",
      ));
    }
  }
  $question .= "</div>\n";
  return $question;
}