public function LogintobogganSettingsForm::submitForm in LoginToboggan 8
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/ LogintobogganSettingsForm.php, line 296
Class
- LogintobogganSettingsForm
- Configure search settings for this site.
Namespace
Drupal\logintoboggan\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$config = $this
->config('logintoboggan.settings');
foreach ($form_state
->getValues() as $key => $value) {
if (!in_array($key, [
'submit',
'form_build_id',
'form_token',
'form_id',
'op',
])) {
if ($key == 'user_email_verification') {
$userconfig = $this
->configFactory()
->getEditable('user.settings');
$userconfig
->set('verify_mail', !$form_state
->getValue('user_email_verification'));
$userconfig
->save();
}
if ($key == 'site_403') {
$site_config = $this
->configFactory()
->getEditable('system.site');
$site_config
->set('page.403', $value == 0 ? '' : '/toboggan/denied');
$site_config
->save();
}
$config
->set($key, $value);
}
}
$config
->save();
if ($form['login']['unified_login']['#default_value'] != $form['login']['unified_login']['#value']) {
$this
->messenger()
->addMessage($this
->t('Unified login setting was changed, menus have been rebuilt.'));
// A regular menu_rebuild() still leaves the old callbacks
// cached -- doing it in a shutdown function seems to correct that issue.
drupal_register_shutdown_function('menu_rebuild');
}
}