function menu_example_menu_link_alter in Examples for Developers 6
Same name and namespace in other branches
- 7 menu_example/menu_example.module \menu_example_menu_link_alter()
Implements hook_menu_link_alter().
This code will get the chance to alter a menu link when it is being saved in the menu interface at admin/build/menu. Whatever we do here overrides anything the user/administrator might have been trying to do.
Parameters
$item: The menu item being saved.
$menu: The entire menu router table.
Related topics
File
- menu_example/
menu_example.module, line 441 - Demonstrates uses of the Menu APIs in Drupal, including hook_menu(), hook_menu_alter(), and hook_menu_link_alter().
Code
function menu_example_menu_link_alter(&$item, $menu) {
// Force the link title to remain 'Clear Cache' no matter what the admin
// does with the web interface.
if ($item['link_path'] == 'devel/cache/clear') {
$item['link_title'] = 'Clear Cache';
}
}