| Versions | |
|---|---|
| 4.7 – 5 | menu_item_delete_form( |
| 6 | menu_item_delete_form(&$form_state, $item) |
| 7 | menu_item_delete_form($form, &$form_state, $item) |
Menu callback; delete a single custom item.
modules/
<?php
function menu_item_delete_form($mid) {
if (!($menu = db_fetch_object(db_query('SELECT type, title FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
}
$form['mid'] = array(
'#type' => 'value',
'#value' => $mid,
);
$form['type'] = array(
'#type' => 'value',
'#value' => $menu->type,
);
$form['title'] = array(
'#type' => 'value',
'#value' => $menu->title,
);
if ($menu->type & MENU_IS_ROOT) {
$message = t('Are you sure you want to delete the menu %item?', array('%item' => theme('placeholder', $menu->title)));
}
else {
$message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => theme('placeholder', $menu->title)));
}
return confirm_form('menu_confirm_delete_form', $form, $message, 'admin/menu', t('This action cannot be undone.'), t('Delete'));
}
?>