You are here

public function ClearConfirmForm::submitForm in MongoDB 8.2

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

modules/mongodb_watchdog/src/Form/ClearConfirmForm.php, line 85

Class

ClearConfirmForm
Provides a confirmation form before clearing out the logs.

Namespace

Drupal\mongodb_watchdog\Form

Code

public function submitForm(array &$form, FormStateInterface $formState) : void {
  $_SESSION['mongodb_watchdog_overview_filter'] = [];
  $this->database
    ->drop();
  $this->logger
    ->ensureSchema();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Database log cleared.'));
  $formState
    ->setRedirectUrl($this
    ->getCancelUrl());
}