public function LegalAdminSettingsForm::submitForm in Legal 2.0.x
Same name and namespace in other branches
- 8 src/Form/LegalAdminSettingsForm.php \Drupal\legal\Form\LegalAdminSettingsForm::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/ LegalAdminSettingsForm.php, line 79
Class
- LegalAdminSettingsForm
- Class LegalAdminSettingsForm.
Namespace
Drupal\legal\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$this->configFactory
->getEditable('legal.settings')
->set('except_roles', $values['except_roles'])
->set('user_profile_display', $values['user_profile_display'])
->set('accept_every_login', $values['accept_every_login'])
->save();
$this
->messenger()
->addMessage($this
->t('Configuration changes have been saved.'));
parent::submitForm($form, $form_state);
// @todo flush only the cache elements that need to be flushed.
drupal_flush_all_caches();
}