You are here

public function LoggingConfigForm::submitForm in Purge 8.3

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

1 call to LoggingConfigForm::submitForm()
LoggingConfigForm::setChannels in modules/purge_ui/src/Form/LoggingConfigForm.php

File

modules/purge_ui/src/Form/LoggingConfigForm.php, line 115

Class

LoggingConfigForm
Configure logging behavior.

Namespace

Drupal\purge_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $has_resulted_in_changes = FALSE;
  if (is_array($values = $form_state
    ->getValue('table'))) {
    foreach ($values as $id => $checkboxes) {
      if ($this->purgeLogger
        ->hasChannel($id)) {
        $grants = [];
        foreach ($checkboxes as $severity => $checked) {
          if ($checked === "1") {
            $grants[] = $severity;
          }
        }
        $this->purgeLogger
          ->setChannel($id, $grants);
        if (!$has_resulted_in_changes) {
          $has_resulted_in_changes = TRUE;
        }
      }
    }
  }
  return $has_resulted_in_changes;
}