You are here

public function ObjectLogClearLogForm::submitForm in Object Log 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/ObjectLogClearLogForm.php, line 65
Contains ObjectLogClearLogForm.

Class

ObjectLogClearLogForm
Provides the form that clears the Object Log table.

Namespace

Drupal\object_log\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->database
    ->delete('object_log')
    ->execute();
  $this
    ->messenger()
    ->addStatus($this
    ->t('Object log cleared.'));
  $form_state
    ->setRedirect('object_log.listing');
}