function i18n_language_switch_links_alter in Internationalization 7
Implements hook_language_switch_links_alter().
Replaces links with pointers to translated versions of the content.
File
- ./
i18n.module, line 557 - Internationalization (i18n) module.
Code
function i18n_language_switch_links_alter(array &$links, $type, $path) {
// For the front page we have nothing to add to Drupal core links.
if ($path != '<front>' && ($translations = i18n_get_path_translations($path))) {
foreach ($translations as $langcode => $translation) {
if (isset($links[$langcode])) {
$links[$langcode]['href'] = $translation['href'];
if (!empty($translation['title'])) {
$links[$langcode]['attributes']['title'] = $translation['title'];
}
}
}
}
}