Same name and namespace in other branches
  1. 7.x modules/system/system.api.php \hook_menu_link_alter()

Alter the data being saved to the {menu_links} table by menu_link_save().

Parameters

$item: Associative array defining a menu link as passed into menu_link_save().

$menu: Associative array containg the menu router returned from menu_router_build().

Return value

None.

Related topics

1 invocation of hook_menu_link_alter()
menu_link_save in includes/menu.inc
Save a menu link.

File

developer/hooks/core.php, line 377
These are the hooks that are invoked by the Drupal core.

Code

function hook_menu_link_alter(&$item, $menu) {

  // Example 1 - make all new admin links hidden (a.k.a disabled).
  if (strpos($item['link_path'], 'admin') === 0 && empty($item['mlid'])) {
    $item['hidden'] = 1;
  }

  // Example 2  - flag a link to be altered by hook_translated_menu_link_alter()
  if ($item['link_path'] == 'devel/cache/clear') {
    $item['options']['alter'] = TRUE;
  }
}