Alter menu links when loaded and before they are rendered.
This hook is only invoked if $menu_link->options['alter'] has been set to a non-empty value (e.g., TRUE). This flag should be set using hook_menu_link_presave(). @ todo The paragraph above is lying! This hasn't been (re)implemented yet.
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,
array $menu_links: An array of menu link entities.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_menu_link_load($menu_links) {
foreach ($menu_links as $menu_link) {
if ($menu_link->href == 'devel/cache/clear') {
$menu_link->options['query'] = drupal_get_destination();
}
}
}