public function SettingsForm::submitForm in Lightning Core 8.3
Same name and namespace in other branches
- 8.5 modules/lightning_roles/src/Form/SettingsForm.php \Drupal\lightning_roles\Form\SettingsForm::submitForm()
- 8 modules/lightning_roles/src/Form/SettingsForm.php \Drupal\lightning_roles\Form\SettingsForm::submitForm()
- 8.2 modules/lightning_roles/src/Form/SettingsForm.php \Drupal\lightning_roles\Form\SettingsForm::submitForm()
- 8.4 modules/lightning_roles/src/Form/SettingsForm.php \Drupal\lightning_roles\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
- modules/
lightning_roles/ src/ Form/ SettingsForm.php, line 85
Class
- SettingsForm
- The settings form for controlling Lightning Roles' behavior.
Namespace
Drupal\lightning_roles\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('lightning_roles.settings');
$roles = $config
->get('content_roles');
foreach ($form_state
->getValue('content_roles') as $key => $value) {
$roles[$key]['enabled'] = (bool) $value;
}
$config
->set('content_roles', $roles)
->save();
parent::submitForm($form, $form_state);
}