You are here

function i18n_forum_node_view in Internationalization 7

Implements hook_node_view().

Localize breadcrumb for forum nodes.

File

i18n_forum/i18n_forum.module, line 66
i18n forum module

Code

function i18n_forum_node_view($node, $view_mode, $langcode) {
  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(i18n_taxonomy_vocabulary_name($vocabulary), 'forum');
      if ($parents = taxonomy_get_parents_all($node->forum_tid)) {
        $parents = array_reverse($parents);
        foreach ($parents as $parent) {
          $breadcrumb[] = l(i18n_taxonomy_term_name($parent), 'forum/' . $parent->tid);
        }
      }
      drupal_set_breadcrumb($breadcrumb);
    }
  }
}