function hook_menu_link_alter

You are here

7 system.api.php hook_menu_link_alter(&$item)
6 core.php hook_menu_link_alter(&$item, $menu)

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


$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


Related topics

1 function implements hook_menu_link_alter()

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

hook_translated_menu_link_alter in developer/hooks/core.php
Alter a menu link after it's translated, but before it's rendered.
1 invocation of hook_menu_link_alter()
menu_link_save in includes/
Save a menu link.


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


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;