You are here

function filelog_logging_settings_submit in File Log 8

Same name and namespace in other branches
  1. 2.0.x filelog.module \filelog_logging_settings_submit()

Form submission handler for system_logging_settings().

See also

filelog_form_system_logging_settings_alter()

1 string reference to 'filelog_logging_settings_submit'
filelog_form_system_logging_settings_alter in ./filelog.module
Implements hook_form_FORM_ID_alter() for system_logging_settings().

File

./filelog.module, line 271
Contains filelog.module.

Code

function filelog_logging_settings_submit(array $form, FormStateInterface $formState) {
  $config = Drupal::configFactory()
    ->getEditable('filelog.settings');
  $config
    ->set('enabled', $formState
    ->getValue('filelog_enabled'));
  $channels = trim($formState
    ->getValue([
    'filelog',
    'channels',
  ]));
  $formState
    ->setValue([
    'filelog',
    'channels',
  ], $channels ? explode('\\n', $channels) : []);
  foreach ((array) $formState
    ->getValue('filelog') as $key => $value) {
    $config
      ->set($key, $value);
  }
  $config
    ->save();
}