You are here

function menu_delete_menu_confirm in Drupal 7

Same name and namespace in other branches
  1. 6 modules/menu/menu.admin.inc \menu_delete_menu_confirm()

Build a confirm form for deletion of a custom menu.

1 string reference to 'menu_delete_menu_confirm'
menu_delete_menu_page in modules/menu/menu.admin.inc
Menu callback; check access and get a confirm form for deletion of a custom menu.

File

modules/menu/menu.admin.inc, line 537
Administrative page callbacks for menu module.

Code

function menu_delete_menu_confirm($form, &$form_state, $menu) {
  $form['#menu'] = $menu;
  $caption = '';
  $num_links = db_query("SELECT COUNT(*) FROM {menu_links} WHERE menu_name = :menu", array(
    ':menu' => $menu['menu_name'],
  ))
    ->fetchField();
  if ($num_links) {
    $caption .= '<p>' . format_plural($num_links, '<strong>Warning:</strong> There is currently 1 menu link in %title. It will be deleted (system-defined items will be reset).', '<strong>Warning:</strong> There are currently @count menu links in %title. They will be deleted (system-defined links will be reset).', array(
      '%title' => $menu['title'],
    )) . '</p>';
  }
  $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
  return confirm_form($form, t('Are you sure you want to delete the custom menu %title?', array(
    '%title' => $menu['title'],
  )), 'admin/structure/menu/manage/' . $menu['menu_name'], $caption, t('Delete'));
}