translation_language_switch_links_alter
- Versions
- 7
translation_language_switch_links_alter(array &$links, $type, $path)
Implement hook_language_switch_link_alter().
Replaces links with pointers to translated versions of the content.
Code
modules/translation/translation.module, line 406
<?php
function translation_language_switch_links_alter(array &$links, $type, $path) {
if ($type == LANGUAGE_TYPE_CONTENT && $paths = translation_path_get_translations($path)) {
foreach ($links as $langcode => $link) {
if (isset($paths[$langcode])) {
// Translation in a different node.
$links[$langcode]['href'] = $paths[$langcode];
}
else {
// No translation in this language, or no permission to view.
unset($links[$langcode]);
}
}
}
}
?>Login or register to post comments 