function faq_view_question in Frequently Asked Questions 6
Same name and namespace in other branches
- 7.2 faq.module \faq_view_question()
- 7 faq.module \faq_view_question()
Helper function to setup the faq question.
Parameters
&$data: Array reference to store display data in.
$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.
7 calls to faq_view_question()
- 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_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.
- template_preprocess_faq_category_questions_top_answers in includes/
faq.questions_top.inc - Create categorized answers for FAQ page if set to show the questions on top.
- template_preprocess_faq_hide_answer in includes/
faq.hide_answer.inc - Create FAQ page if set to show/hide answer when question is clicked.
File
- ./
faq.module, line 1127 - 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_question(&$data, $node, $path = NULL, $anchor = NULL) {
$disable_node_links = variable_get('faq_disable_node_links', FALSE);
$question = '';
// 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($node->title);
}
elseif (empty($path)) {
// Can't seem to use l() function with empty string as screen-readers
// don't like it, so create anchor name manually.
$question = '<a id="' . $anchor . '"></a>' . check_plain($node->title);
}
else {
$options = array();
if ($anchor) {
$options['attributes'] = array(
'id' => $anchor,
);
}
$question = l($node->title, $path, $options);
}
}
else {
if (empty($anchor)) {
$question = l($node->title, "node/{$node->nid}");
}
else {
$question = l($node->title, "node/{$node->nid}", array(
"attributes" => array(
"id" => "{$anchor}",
),
));
}
}
if (variable_get('faq_display', 'questions_top') != 'hide_answer' && !empty($node->detailed_question) && variable_get('faq_question_length', 'short') == 'both') {
$node->detailed_question = check_markup($node->detailed_question, $node->format, FALSE);
$question .= '<div class="faq-detailed-question">' . $node->detailed_question . '</div>';
}
$data['question'] = $question;
}