You are here

public function ErrorlogConfigForm::submitForm in Logging and alerts 8

Same name and namespace in other branches
  1. 2.0.x errorlog/src/Form/ErrorlogConfigForm.php \Drupal\errorlog\Form\ErrorlogConfigForm::submitForm()

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 ConfigFormBase::submitForm

File

errorlog/src/Form/ErrorlogConfigForm.php, line 57

Class

ErrorlogConfigForm
Provides a setting UI for errorlog.

Namespace

Drupal\errorlog\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('errorlog.settings');
  $userInputValues = $form_state
    ->getUserInput();
  foreach (RfcLogLevel::getLevels() as $severity => $description) {
    $key = 'errorlog_' . $severity;
    $config
      ->set($key, $userInputValues[$key]);
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}