1. drupal
    1. 6 core.php
    2. 8
    3. 7
6 – 7 hook_translated_menu_link_alter(&$item, $map)

Alter a menu link after it has been translated and before it is rendered.

This hook is invoked from _menu_link_translate() after a menu link has been translated; i.e., after dynamic path argument placeholders (%) have been replaced with actual values, the user access to the link's target page has been checked, and the link has been localized. It is only invoked if $item['options']['alter'] has been set to a non-empty value (e.g., TRUE). This flag should be set using hook_menu_link_alter().

Implementations of this hook are able to alter any property of the menu link. For example, this hook may be used to add a page-specific query string to all menu links, or hide a certain link by setting:

  'hidden' => 1,


$item Associative array defining a menu link after _menu_link_translate()

$map Associative array containing the menu $map (path parts and/or objects).

See also


Related topics


modules/system/system.api.php, line 1286

function hook_translated_menu_link_alter(&$item, $map) {
  if ($item['href'] == 'devel/cache/clear') {
    $item['localized_options']['query'] = drupal_get_destination();