function faq_view_answer in Frequently Asked Questions 6
Same name and namespace in other branches
- 5.2 faq.module \faq_view_answer()
- 7.2 faq.module \faq_view_answer()
- 7 faq.module \faq_view_answer()
Helper function to setup the faq answer.
Parameters
&$data: Array reference to store display data in.
$node: The node object.
$back_to_top: An array containing the "back to top" link.
$teaser: Whether or not to use teasers.
$links: Whether or not to show node links.
7 calls to faq_view_answer()
- 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 1181 - 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_answer(&$data, $node, $back_to_top, $teaser, $links) {
// Build the faq node content and invoke other modules' links, etc, functions.
$node = (object) $node;
$node = node_build_content($node, $teaser, 0);
if ($links) {
$node->links = module_invoke_all('link', 'node', $node, $teaser);
foreach (module_implements('link_alter') as $module) {
$function = $module . '_link_alter';
$function($node->links, $node);
}
}
// Add "edit answer" link if they have the correct permissions.
if (node_access('update', $node)) {
$node->links['faq_edit_link'] = array(
'title' => t('Edit answer'),
'href' => "node/{$node->nid}/edit",
'query' => drupal_get_destination(),
'attributes' => array(
'title' => t('Edit answer'),
),
);
}
// Add "back to top" link.
if (!empty($back_to_top)) {
$node->links['faq_back_to_top'] = $back_to_top;
}
$content = drupal_render($node->content);
node_invoke_nodeapi($node, 'alter', $teaser, 0);
// Unset unused $node text so that a bad theme can not open a security hole.
// $node->body = NULL;
// $node->teaser = NULL;
$data['body'] = $content;
if ($links) {
$data['links'] = theme('links', $node->links);
}
}