function forum_node_view

Implements hook_node_view().

File

modules/forum/forum.module, line 265

Code

function forum_node_view($node, $view_mode) {
    if (!empty($node->forum_tid) && _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);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.