You are here

function menu_example_menu_link_alter in Examples for Developers 7

Same name and namespace in other branches
  1. 6 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.

Related topics

File

menu_example/menu_example.module, line 497
Module file for menu_example.

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';
  }
}