You are here

public function MultiblockDeleteForm::submitForm in MultiBlock 8

Same name in this branch
  1. 8 src/MultiblockDeleteForm.php \Drupal\multiblock\MultiblockDeleteForm::submitForm()
  2. 8 src/Form/MultiblockDeleteForm.php \Drupal\multiblock\Form\MultiblockDeleteForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/MultiblockDeleteForm.php, line 36

Class

MultiblockDeleteForm

Namespace

Drupal\multiblock\Form

Code

public function submitForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  if (multiblock_delete($form_state
    ->getValue([
    'delta',
  ]))) {
    drupal_set_message(t('Block successfully deleted!'));
  }
  else {
    drupal_set_message(t('There was a problem deleting the block'));
  }
  $form_state
    ->set([
    'redirect',
  ], 'admin/structure/block/instances');
}