You are here

public function MaillogClearConfirmForm::submitForm in Maillog / Mail Developer 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/MaillogClearConfirmForm.php, line 53

Class

MaillogClearConfirmForm
Provides a form for clearing all the maillog entries.

Namespace

Drupal\maillog\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  Database::getConnection('default')
    ->truncate('maillog')
    ->execute();
  $this
    ->messenger()
    ->addStatus($this
    ->t("All maillog entries have been deleted."));
  $form_state
    ->setRedirect('maillog.settings');
}