function hook_menu_link_delete

Inform modules that a menu link has been deleted.

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

Parameters

\Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link: A menu link entity.

See also

hook_menu_link_presave()

hook_menu_link_insert()

hook_menu_link_update()

Related topics

2 functions implement hook_menu_link_delete()

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_delete in drupal/core/modules/system/tests/modules/menu_test/menu_test.module
Implements hook_menu_link_delete().
shortcut_menu_link_delete in drupal/core/modules/shortcut/shortcut.module
Implements hook_menu_link_delete().

File

drupal/core/modules/menu_link/menu_link.api.php, line 129
Hooks provided by the Menu link module.

Code

function hook_menu_link_delete(\Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link) {

  // Delete the record from our table.
  db_delete('menu_example')
    ->condition('mlid', $menu_link
    ->id())
    ->execute();
}