You are here

public function AnimateDeleteForm::submitForm in Animate Any 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/AnimateDeleteForm.php, line 45

Class

AnimateDeleteForm
Defines a confirmation form for deleting Animation data from Animation list.

Namespace

Drupal\animate_any\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $aid = $this->id;
  if (is_numeric($aid)) {
    $delete = \Drupal::database()
      ->delete('animate_any_settings')
      ->condition('aid', $aid)
      ->execute();
    if ($delete) {
      $this
        ->messenger()
        ->addMessage($this
        ->t('Record deleted successfully.'));
    }
  }
}