You are here

public function AbjsTestDeleteConfirmForm::submitForm in A/B Test JS 8

Same name and namespace in other branches
  1. 2.0.x src/Form/AbjsTestDeleteConfirmForm.php \Drupal\abjs\Form\AbjsTestDeleteConfirmForm::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/AbjsTestDeleteConfirmForm.php, line 108

Class

AbjsTestDeleteConfirmForm
Class for confirm delete test.

Namespace

Drupal\abjs\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->database
    ->delete('abjs_test')
    ->condition('tid', $this->id)
    ->execute();
  $this->database
    ->delete('abjs_test_condition')
    ->condition('tid', $this->id)
    ->execute();
  $this->database
    ->delete('abjs_test_experience')
    ->condition('tid', $this->id)
    ->execute();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Test %id has been deleted.', [
    '%id' => $this->id,
  ]));
  $form_state
    ->setRedirect('abjs.test_admin');
}