From d9d938926812a0528d24fb505546fce756c79975 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 7 Oct 2010 17:54:35 +0000 Subject: - Patch #366768 by plach, hass, GiorgosK: translation links link to unpublished translation. --- modules/translation/translation.module | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/translation/translation.module b/modules/translation/translation.module index 2fc84e770..c6edf6744 100644 --- a/modules/translation/translation.module +++ b/modules/translation/translation.module @@ -384,7 +384,7 @@ function translation_node_get_translations($tnid) { if (!isset($translations[$tnid])) { $translations[$tnid] = array(); $result = db_select('node', 'n') - ->fields('n', array('nid', 'title', 'language')) + ->fields('n', array('nid', 'type', 'uid', 'status', 'title', 'language')) ->condition('n.tnid', $tnid) ->addTag('node_access') ->execute(); @@ -435,8 +435,11 @@ function translation_path_get_translations($path) { */ function translation_language_switch_links_alter(array &$links, $type, $path) { if ($type == LANGUAGE_TYPE_INTERFACE && $paths = translation_path_get_translations($path)) { + $path = explode('/', $path); + $node = node_load($path[1]); + $translations = translation_node_get_translations($node->tnid); foreach ($links as $langcode => $link) { - if (isset($paths[$langcode])) { + if (isset($paths[$langcode]) && $translations[$langcode]->status) { // Translation in a different node. $links[$langcode]['href'] = $paths[$langcode]; } -- cgit v1.2.3