function filelog_logging_settings_submit in File Log 2.0.x
Same name and namespace in other branches
- 8 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 279 - 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',
]));
$channels = preg_replace('/[\\r\\n]+/', "\n", $channels);
$formState
->setValue([
'filelog',
'channels',
], $channels ? explode("\n", $channels) : []);
foreach ((array) $formState
->getValue('filelog') as $key => $value) {
$config
->set($key, $value);
}
$config
->save();
}