6.x core.php hook_translation_link_alter(&$links, $path)

Perform alterations on translation links.

A translation link may need to point to a different path or use a translated link text before going through l(), which will just handle the path aliases.


$links: Nested array of links keyed by language code.

$path: The current path.

Return value


Related topics

1 function implements hook_translation_link_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

translation_translation_link_alter in modules/translation/translation.module
Implementation of hook_translation_link_alter().


developer/hooks/core.php, line 2808
These are the hooks that are invoked by the Drupal core.


function hook_translation_link_alter(&$links, $path) {
  global $language;
  if (isset($links[$language])) {
    foreach ($links[$language] as $link) {
      $link['attributes']['class'] .= ' active-language';