public function SettingsForm::submitForm in Session Limit 2.x
Same name and namespace in other branches
- 8 src/Form/SettingsForm.php \Drupal\session_limit\Form\SettingsForm::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
- src/
Form/ SettingsForm.php, line 158
Class
- SettingsForm
- Class SettingsForm.
Namespace
Drupal\session_limit\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('session_limit.settings');
$config
->set('session_limit_max', $form_state
->getValue($form['session_limit_max']['#parents']));
$config
->set('session_limit_behaviour', $form_state
->getValue($form['session_limit_behaviour']['#parents']));
$config
->set('session_limit_logged_out_message_severity', $form_state
->getValue($form['session_limit_logged_out_message_severity']['#parents']));
$config
->set('session_limit_admin_inclusion', $form_state
->getValue($form['session_limit_admin_inclusion']['#parents']));
$role_limits = [];
foreach (user_roles(TRUE) as $rid => $role) {
$role_limits[$rid] = $form_state
->getValue($form['session_limit_roles'][$rid]['#parents']);
}
$config
->set('session_limit_roles', $role_limits);
if (!empty($form['session_limit_masquerade_ignore'])) {
$config
->set('session_limit_masquerade_ignore', $form_state
->getValue($form['session_limit_masquerade_ignore']['#parents']));
}
$config
->save();
if (method_exists($this, '_submitForm')) {
$this
->_submitForm($form, $form_state);
}
parent::submitForm($form, $form_state);
}