function i18n_link_alter in Internationalization 6
Implementation of hook_link_alter().
Handles links for extended languages. Sets current interface language.
File
- ./
i18n.module, line 231 - Internationalization (i18n) module.
Code
function i18n_link_alter(&$links, $node) {
global $language;
$language_support = variable_get('i18n_node_' . $node->type, LANGUAGE_SUPPORT_NORMAL);
// Hide node translation links.
if (variable_get('i18n_hide_translation_links', 0) == 1) {
foreach ($links as $module => $link) {
if (strpos($module, 'node_translation') === 0) {
unset($links[$module]);
}
}
}
if (!empty($node->tnid)) {
foreach (array_keys(i18n_language_list('extended')) as $langcode) {
$index = 'node_translation_' . $langcode;
if (!empty($links[$index])) {
if ($language_support != LANGUAGE_SUPPORT_EXTENDED && $links[$index]['language']->enabled == 0) {
unset($links[$index]);
}
else {
$links[$index]['language'] = $language;
}
}
}
}
}