Same name and namespace in other branches
  1. 4.6.x modules/forum.module \forum_view()
  2. 4.7.x modules/forum.module \forum_view()

Implementation of hook_view().

File

modules/forum/forum.module, line 288
Enable threaded discussions about general topics.

Code

function forum_view(&$node, $teaser = FALSE, $page = FALSE) {
  drupal_add_css(drupal_get_path('module', 'forum') . '/forum.css');
  if ($page) {
    $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));

    // Breadcrumb navigation
    $breadcrumb = array();
    $breadcrumb[] = array(
      'path' => 'forum',
      'title' => $vocabulary->name,
    );
    if ($parents = taxonomy_get_parents_all($node->tid)) {
      $parents = array_reverse($parents);
      foreach ($parents as $p) {
        $breadcrumb[] = array(
          'path' => 'forum/' . $p->tid,
          'title' => $p->name,
        );
      }
    }
    $breadcrumb[] = array(
      'path' => 'node/' . $node->nid,
    );
    menu_set_location($breadcrumb);
  }
  $node = node_prepare($node, $teaser);
  if (!$teaser) {
    $node->content['forum_navigation'] = array(
      '#value' => theme('forum_topic_navigation', $node),
      '#weight' => 100,
    );
  }
  return $node;
}