function faq_view in Frequently Asked Questions 5.2
Same name and namespace in other branches
- 5 faq.module \faq_view()
- 6 faq.module \faq_view()
- 7 faq.module \faq_view()
Display a FAQ node.
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 282 - 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) {
if ($page) {
$breadcrumb = array();
$breadcrumb[] = array(
'path' => 'node/' . $node->nid,
);
if (module_exists("taxonomy") && $node->taxonomy) {
foreach ($node->taxonomy as $term) {
$current = $term;
continue;
}
$breadcrumb[] = array(
'path' => 'faq/' . $current->tid,
'title' => $current->name,
);
while ($parents = taxonomy_get_parents($current->tid)) {
$current = array_shift($parents);
$breadcrumb[] = array(
'path' => 'faq/' . $current->tid,
'title' => $current->name,
);
}
}
$breadcrumb[] = array(
'path' => 'faq',
'title' => variable_get('faq_title', 'Frequently Asked Questions'),
);
$breadcrumb = array_reverse($breadcrumb);
menu_set_location($breadcrumb);
}
$node = node_prepare($node, $teaser);
return $node;
}