You are here

function forum_node_view in Drupal 7

Implements hook_node_view().

File

modules/forum/forum.module, line 265
Provides discussion forums.

Code

function forum_node_view($node, $view_mode) {
  if (_forum_node_check_node_type($node)) {
    if ($view_mode == 'full' && node_is_page($node)) {
      $vid = variable_get('forum_nav_vocabulary', 0);
      $vocabulary = taxonomy_vocabulary_load($vid);

      // Breadcrumb navigation
      $breadcrumb[] = l(t('Home'), NULL);
      $breadcrumb[] = l($vocabulary->name, 'forum');
      if ($parents = taxonomy_get_parents_all($node->forum_tid)) {
        $parents = array_reverse($parents);
        foreach ($parents as $parent) {
          $breadcrumb[] = l($parent->name, 'forum/' . $parent->tid);
        }
      }
      drupal_set_breadcrumb($breadcrumb);
    }
  }
}