You are here

function delete_menu_options_form_alter in Delete menu options 6

Same name and namespace in other branches
  1. 7 delete_menu_options.module \delete_menu_options_form_alter()

Implements hook_form_alter().

This hook adds 2 checkboxes which the user may select to delete child menu items and/or the referenced node(s)."

File

./delete_menu_options.module, line 25
Provides extra options when deleting a menu item.

Code

function delete_menu_options_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#id'] === 'menu-item-delete-form') {
    if (user_access('administer nodes')) {
      $form['delete_menu_children']['#type'] = 'checkbox';
      $form['delete_menu_children']['#title'] = t('Delete all children of this menu.');
      $form['delete_menu_node']['#type'] = 'checkbox';
      $form['delete_menu_node']['#title'] = t('Delete nodes referenced by the menu items that will be deleted (orphaned nodes only).');
      $form['#submit'] = array(
        'delete_menu_options_item_form_submit',
      );
    }
  }
}