public function ModuleConfigForm::submitForm in Field Label 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/ ModuleConfigForm.php, line 171
Class
- ModuleConfigForm
- Class ModuleConfigForm.
Namespace
Drupal\field_label\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Retrieve the configuration.
$config = $this
->configFactory()
->getEditable(static::SETTINGS);
// Set all feature 'enabled' values.
$config
->set('label_value_enabled', $form_state
->getValue('label_value_enabled'))
->set('label_class_enabled', $form_state
->getValue('label_class_enabled'))
->set('label_class_select_enabled', $form_state
->getValue('label_class_select_enabled'))
->set('class_list', $form_state
->getValue('class_list'))
->set('label_tag_enabled', $form_state
->getValue('label_tag_enabled'));
// Process allowed tags even if disabled to keep defaults.
$tags = array_filter(explode(' ', $form_state
->getValue('allowed_tags')));
$config
->set('allowed_tags', $tags);
$config
->save();
parent::submitForm($form, $form_state);
}