function faq_view in Frequently Asked Questions 6
Same name and namespace in other branches
- 5.2 faq.module \faq_view()
- 5 faq.module \faq_view()
- 7 faq.module \faq_view()
Implements hook_view().
Parameters
$node: Which node to show.
$teaser: Boolean variable, if set to TRUE, it will show only a short part of the content.
$page: Boolean variable, if set to TRUE, it will setup the breadcrumbs.
Return value
The node object.
File
- ./
faq.module, line 328 - 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($node, $teaser = FALSE, $page = FALSE) {
drupal_add_css(drupal_get_path('module', 'faq') . '/faq.css');
$node = node_prepare($node, $teaser);
$node->detailed_question = check_markup($node->detailed_question, $node->format, FALSE);
$content = $node->content['body']['#value'];
if (!empty($node->detailed_question) && variable_get('faq_question_length', 'short') == 'both' && (variable_get('faq_display', 'questions_top') == 'hide_answer' || drupal_match_path($_GET['q'], 'node/' . $node->nid))) {
$node->content['body']['#value'] = '<div class="faq-detailed-question">' . $node->detailed_question . '</div>' . $content;
}
return $node;
}