function hook_translated_menu_link_alter
7.x system.api.php | hook_translated_menu_link_alter(&$item, $map) |
6.x core.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
Related topics
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- user_translated_menu_link_alter in drupal-7.x/
modules/ user/ user.module - Implements hook_translated_menu_link_alter().
- _menu_link_translate in drupal-7.x/
includes/ menu.inc - Provides menu link access control, translation, and argument handling.
File
- drupal-7.x/
modules/ system/ system.api.php, line 1346 - Hooks provided by Drupal core and the System module.
Code
function hook_translated_menu_link_alter(&$item, $map) {
if ($item['href'] == 'devel/cache/clear') {
$item['localized_options']['query'] = drupal_get_destination();
}
}