| 6 core.php | hook_menu_alter(&$items) |
| 7 system.api.php | hook_menu_alter(&$items) |
| 8 system.api.php | hook_menu_alter(&$items) |
Alter the data being saved to the {menu_router} table after hook_menu is invoked.
This hook is invoked by menu_router_build(). The menu definitions are passed in by reference. Each element of the $items array is one item returned by a module from hook_menu. Additional items may be added, or existing items altered.
Parameters
$items: Associative array of menu router definitions returned from hook_menu().
Return value
None.
Related topics
File
- developer/
hooks/ core.php, line 356 - These are the hooks that are invoked by the Drupal core.
Code
<?php
function hook_menu_alter(&$items) {
// Example - disable the page at node/add
$items['node/add']['access callback'] = FALSE;
}
?> Login or register to post comments
Comments
Remove the user register and password tabs on registration page
1. Find or add a custom module, and add this to the [MODULENAME].module
<?phpfunction [MODULENAME]_menu_alter(&$items) {
$items['user']['type'] = MENU_CALLBACK;
$items['user/register']['type'] = MENU_CALLBACK;
$items['user/password']['type'] = MENU_CALLBACK;
}
?>
2. Go to Site Configuration > Site Performance, Click Clear Cache
3. Open a second browser and navigate to /user and it should be gone! Yay!
Clearing menu cache (rebuilding the menu)
Instead of manually clearing the cache, try:
menu_rebuild();drupal_set_message('The menu has been rebuilt.');
Works for me :)
Change the core contact form title "Contact" to whatever
function modulename_menu_alter(&$items){
$items['contact']['title'] = 'Whatever';
}//end modulename_menu_alter
Removing the RSS feed (/rss.xml)
If you want to remove the rss feed (/rss.xml), use the following snippet:
<?phpfunction MYMODULE_menu_alter(&$items) {
unset($items['rss.xml']);
}
?>
$items['contact']['access
$items['contact']['access callback'] = FALSE;
works fine, but
$items['contact']['title'] = 'Whatever';
does not work. Why?
sorry, it is question for
sorry, it is question for drupal 7
The menu definitions are
The menu definitions are passed in by reference.
VMware VCP-510Each element of the $items array is one item returned by a module from hook_menu.Cisco 640-802 Additional items may be added, or existing items altered.VMware VCP-410
remove: tab menu in "user/password"
I haver create my module but if i go to "user/password" how can i remove the tab?
Thanks
Manu Medina