hook_menu_link_alter

Versions
6
hook_menu_link_alter(&$item, $menu)
7
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().

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

Return value

None.

Related topics

Code

developer/hooks/core.php, line 338

<?php
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;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.