function menu_link_delete

Delete one or several menu links.

Parameters

$mlid: A valid menu link mlid or NULL. If NULL, $path is used.

$path: The path to the menu items to be deleted. $mlid must be NULL.

Related topics

9 calls to menu_link_delete()
book_node_predelete in drupal/core/modules/book/book.module
Implements hook_node_predelete().
book_remove_form_submit in drupal/core/modules/book/book.pages.inc
Form submission handler for book_remove_form().
LinksTest::testMenuLinkReparenting in drupal/core/modules/system/lib/Drupal/system/Tests/Menu/LinksTest.php
Test automatic reparenting of menu links.
menu_delete_menu_confirm_submit in drupal/core/modules/menu/menu.admin.inc
Delete a custom menu and all links in it.
menu_item_delete_form_submit in drupal/core/modules/menu/menu.admin.inc
Process menu delete form submissions.

... See full list

File

drupal/core/includes/menu.inc, line 2941
API for the Drupal menu system.

Code

function menu_link_delete($mlid, $path = NULL) {
  if (isset($mlid)) {
    _menu_delete_item(db_query("SELECT * FROM {menu_links} WHERE mlid = :mlid", array(
      ':mlid' => $mlid,
    ))
      ->fetchAssoc());
  }
  else {
    $result = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(
      ':link_path' => $path,
    ));
    foreach ($result as $link) {
      _menu_delete_item($link);
    }
  }
}