From 8ec40cc27a72e3dec43d80432a3250af7c03aed3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 3 Oct 2010 01:15:34 +0000 Subject: - Patch #922824 by plach: no way to specify the language to view entities in. --- modules/taxonomy/taxonomy.module | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'modules/taxonomy') diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index d73196313..c214dca18 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -599,11 +599,18 @@ function taxonomy_term_delete($tid) { * A term object. * @param $view_mode * View mode, e.g. 'full', 'teaser'... + * @param $langcode + * (optional) A language code to use for rendering. Defaults to the global + * content language of the current request. * * @return * An array as expected by drupal_render(). */ -function taxonomy_term_view($term, $view_mode = 'full') { +function taxonomy_term_view($term, $view_mode = 'full', $langcode = NULL) { + if (!isset($langcode)) { + $langcode = $GLOBALS['language_content']->language; + } + field_attach_prepare_view('taxonomy_term', array($term->tid => $term), $view_mode); entity_prepare_view('taxonomy_term', array($term->tid => $term)); @@ -611,9 +618,10 @@ function taxonomy_term_view($term, $view_mode = 'full') { '#theme' => 'taxonomy_term', '#term' => $term, '#view_mode' => $view_mode, + '#language' => $langcode, ); - $build += field_attach_view('taxonomy_term', $term, $view_mode); + $build += field_attach_view('taxonomy_term', $term, $view_mode, $langcode); $build['description'] = array( '#markup' => check_markup($term->description, $term->format, '', TRUE), -- cgit v1.2.3