You are here

function faq_view in Frequently Asked Questions 5

Same name and namespace in other branches
  1. 5.2 faq.module \faq_view()
  2. 6 faq.module \faq_view()
  3. 7 faq.module \faq_view()

File

./faq.module, line 196

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', t('Frequently Asked Questions')),
    );
    $breadcrumb = array_reverse($breadcrumb);
    menu_set_location($breadcrumb);
  }
  $node = node_prepare($node, $teaser);
  return $node;
}