function forum_node_view

Implements hook_node_view().

File

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

Code

function forum_node_view(Node $node, $view_mode) {
  $vid = config('forum.settings')
    ->get('vocabulary');
  $vocabulary = taxonomy_vocabulary_load($vid);
  if (_forum_node_check_node_type($node)) {
    if ($view_mode == 'full' && node_is_page($node)) {

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