summaryrefslogtreecommitdiff
path: root/modules/translation
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-10-07 17:54:35 +0000
committerDries Buytaert <dries@buytaert.net>2010-10-07 17:54:35 +0000
commitd9d938926812a0528d24fb505546fce756c79975 (patch)
tree2325d800d1c3f1d533fb86b6c3124002a2738fe2 /modules/translation
parent2a3d1886926b9e2e733651001935e0bf5501dcc0 (diff)
downloadbrdo-d9d938926812a0528d24fb505546fce756c79975.tar.gz
brdo-d9d938926812a0528d24fb505546fce756c79975.tar.bz2
- Patch #366768 by plach, hass, GiorgosK: translation links link to unpublished translation.
Diffstat (limited to 'modules/translation')
-rw-r--r--modules/translation/translation.module7
1 files changed, 5 insertions, 2 deletions
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];
}