You are here

function hook_menu_link_update in Drupal 7

Inform modules that a menu link has been updated.

This hook is used to notify modules that menu items have been updated. Contributed modules may use the information to perform actions based on the information entered into the menu system.

Parameters

$link: Associative array defining a menu link as passed into menu_link_save().

See also

hook_menu_link_insert()

hook_menu_link_delete()

Related topics

1 function implements hook_menu_link_update()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

menu_test_menu_link_update in modules/simpletest/tests/menu_test.module
Implements hook_menu_link_update().

File

modules/system/system.api.php, line 1387
Hooks provided by Drupal core and the System module.

Code

function hook_menu_link_update($link) {

  // If the parent menu has changed, update our record.
  $menu_name = db_query("SELECT menu_name FROM {menu_example} WHERE mlid = :mlid", array(
    ':mlid' => $link['mlid'],
  ))
    ->fetchField();
  if ($menu_name != $link['menu_name']) {
    db_update('menu_example')
      ->fields(array(
      'menu_name' => $link['menu_name'],
    ))
      ->condition('mlid', $link['mlid'])
      ->execute();
  }
}