function menu_delete_edit_form_submit in Menu Delete 8
Same name and namespace in other branches
- 8.2 menu_delete.module \menu_delete_edit_form_submit()
Form submit handler.
1 string reference to 'menu_delete_edit_form_submit'
- menu_delete_form_alter in ./
menu_delete.module - Implements hook_form_alter().
File
- ./
menu_delete.module, line 50 - Contains menu_delete.module.
Code
function menu_delete_edit_form_submit($form, FormStateInterface $form_state) {
$items = array();
foreach ($form_state
->getValues()['links'] as $id => $link) {
if (isset($link['delete']) && $link['delete'] == TRUE) {
$items[$id] = $link;
}
}
if (count($items) > 0) {
$store = array(
'menu_id' => $form['id']['#default_value'],
'items' => $items,
);
$temp_store = \Drupal::service('user.private_tempstore')
->get('menu_delete_item_confirm');
$temp_store
->set(\Drupal::service('current_user')
->id(), $store);
$menu_id = $form_state
->getValues()['id'];
$form_state
->setRedirect('menu_delete.multiple_delete_confirm', array(
'menu' => $menu_id,
));
}
}