| 6 core.php | hook_menu_link_alter(&$item, |
| 7 system.api.php | hook_menu_link_alter(&$item) |
| 8 system.api.php | 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
File
- developer/
hooks/ core.php, line 371 - These are the hooks that are invoked by the Drupal core.
Code
<?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