You are here

public function SiteVerifyDeleteForm::submitForm in Site verification 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/SiteVerifyDeleteForm.php, line 75

Class

SiteVerifyDeleteForm
Builds the form to delete a forum term.

Namespace

Drupal\site_verify\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $record = $form_state
    ->getValue('record');
  \Drupal::database()
    ->delete('site_verify')
    ->condition('svid', $record['svid'])
    ->execute();
  $this
    ->messenger()
    ->addStatus(t('Verification for %engine has been deleted.', [
    '%engine' => $record['engine']['name'],
  ]));
  \Drupal::logger('site_verify')
    ->notice(t('Verification for %engine deleted.', [
    '%engine' => $record['engine']['name'],
  ]));
  $form_state
    ->setRedirect('site_verify.verifications_list');

  // Set the menu to be rebuilt.
  \Drupal::service('router.builder')
    ->setRebuildNeeded();
}