Commit d9d93892 authored by Dries's avatar Dries

- Patch #366768 by plach, hass, GiorgosK: translation links link to unpublished translation.

parent 2a3d1886
......@@ -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];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment