You are here

public function SearchLogClearDataForm::submitForm in Search 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/SearchLogClearDataForm.php, line 62

Class

SearchLogClearDataForm
Defines a confirmation form to confirm deletion of search logs.

Namespace

Drupal\search_log\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->database
    ->truncate('search_log')
    ->execute();
  $this->messenger
    ->addMessage('Search Log Data Cleared!');
  $form_state
    ->setRedirect('search_log.admin_config');
}