function hook_language_switch_links_alter

hook_language_switch_links_alter(array &$links, $type, $path)

Perform alterations on language switcher links.

A language switcher 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.

Parameters

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

$type: The language type the links will switch.

$path: The current path.

Related topics

File

modules/system/language.api.php, line 54
Hooks provided by the base system for language support.

Code

function hook_language_switch_links_alter(array &$links, $type, $path) {
  global $language;

  if ($type == LANGUAGE_TYPE_CONTENT && isset($links[$language->language])) {
    foreach ($links[$language->language] as $link) {
      $link['attributes']['class'][] = 'active-language';
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!language.api.php/function/hook_language_switch_links_alter/7.x