public function BetterFieldDescriptionsEntitiesForm::submitForm in Better Field Descriptions 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/ BetterFieldDescriptionsEntitiesForm.php, line 96
Class
- BetterFieldDescriptionsEntitiesForm
- Displays the better_field_descriptions_entities settings form.
Namespace
Drupal\better_field_descriptions\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Get the config settings.
$config = $this
->config('better_field_descriptions.settings');
// We don't want our settings to contain 0-values, only selected values.
$selected = array_filter($form_state
->getValue('entities'));
$bfde = [];
foreach ($selected as $entity_type => $checked) {
$bfde[$entity_type] = $entity_type;
}
$config
->set('better_field_descriptions_entities', $bfde);
$config
->save();
parent::submitForm($form, $form_state);
}