function hook_translated_menu_link_alter
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
File
- 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(); } }
© 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!system.api.php/function/hook_translated_menu_link_alter/7.x