public function ApplyForRoleAdminForm::submitForm in Apply for role 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/ ApplyForRoleAdminForm.php, line 207
Class
Namespace
Drupal\apply_for_role\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Load configuration object
$config = $this
->config('apply_for_role.settings');
// Get all submitted values, clean so just user inputted values.
$submitted_values = $form_state
->cleanValues()
->getValues();
// Loop through all submitted values, assigning to corresponding config value.
foreach ($submitted_values as $submitted_value_key => $submitted_value) {
$config
->set($submitted_value_key, $submitted_value);
}
// Save all of the updated the values.
$config
->save();
parent::submitForm($form, $form_state);
}