hook_menu_link_alter

  1. drupal
    1. 6 core.php
    2. 8
    3. 7
Versions
6 hook_menu_link_alter(&$item, $menu)
7 – 8 hook_menu_link_alter(&$item)

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().

See also

hook_translated_menu_link_alter()

Related topics

Code

modules/system/system.api.php, line 1245

<?php
function hook_menu_link_alter(&$item) {
  // Make all new admin links hidden (a.k.a disabled).
  if (strpos($item['link_path'], 'admin') === 0 && empty($item['mlid'])) {
    $item['hidden'] = 1;
  }
  // Flag a link to be altered by hook_translated_menu_link_alter().
  if ($item['link_path'] == 'devel/cache/clear') {
    $item['options']['alter'] = TRUE;
  }
  // Flag a link to be altered by hook_translated_menu_link_alter(), but only
  // if it is derived from a menu router item; i.e., do not alter a custom
  // menu link pointing to the same path that has been created by a user.
  if ($item['link_path'] == 'user' && $item['module'] == 'system') {
    $item['options']['alter'] = TRUE;
  }
}
?>