public function SettingsForm::submitForm in Improved Multi Select 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/ SettingsForm.php, line 165
Class
- SettingsForm
- Class SettingsForm.
Namespace
Drupal\improved_multi_select\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values_to_save = [
'isall',
'url',
'selectors',
'placeholder_text',
'filtertype',
'orderable',
'js_regex',
'groupresetfilter',
'remove_required_attr',
'buttontext_add',
'buttontext_addall',
'buttontext_del',
'buttontext_delall',
'buttontext_moveup',
'buttontext_movedown',
];
$values = $form_state
->getValues();
foreach ($values as $key => $value) {
if (array_search($key, $values_to_save) === FALSE) {
unset($values[$key]);
}
}
$this
->config('improved_multi_select.settings')
->setData($values)
->save();
}