You are here

public function CallbackDeleteForm::submitForm in Empty Page 8

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/CallbackDeleteForm.php, line 58

Class

CallbackDeleteForm
Provides a form to delete a empty page.

Namespace

Drupal\empty_page\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $callback = $this->callback;
  \Drupal::configFactory()
    ->getEditable('empty_page.settings')
    ->clear('callback_' . $callback['cid'])
    ->save();
  \Drupal::service('router.builder')
    ->rebuild();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Callback <em>:path</em> deleted.', [
    ':path' => $callback->path,
  ]));
  $form_state
    ->setRedirect('empty_page.administration');
}