1 system.api.php 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,

Parameters

$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

hook_menu_link_alter()

Related topics

File

core/modules/system/system.api.php, line 997
Hooks provided by Backdrop core and the System module.

Code

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