function hook_menu_link_load

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,

Parameters

array $menu_links: An array of menu link entities.

See also

hook_menu_link_presave()

Related topics

3 functions implement hook_menu_link_load()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

book_menu_link_load in drupal/core/modules/book/book.module
Implements hook_TYPE_load().
shortcut_menu_link_load in drupal/core/modules/shortcut/shortcut.module
Implements hook_TYPE_load().
user_menu_link_load in drupal/core/modules/user/user.module
Implements hook_menu_link_load().

File

drupal/core/modules/menu_link/menu_link.api.php, line 33
Hooks provided by the Menu link module.

Code

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();
    }
  }
}