public function AutosaveFormSettingsForm::submitForm in Autosave Form 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/ AutosaveFormSettingsForm.php, line 192
Class
- AutosaveFormSettingsForm
- Configure autosave form settings for this site.
Namespace
Drupal\autosave_form\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Config\Config $config */
$config = $this
->config('autosave_form.settings');
$allowed_content_entity_types = [];
foreach ($form_state
->getValue('allowed_content_entities') as $entity_type_id => $data) {
if (!$data['active']) {
continue;
}
$allowed_bundles = array_filter($data['bundles']['selection']);
$allowed_content_entity_types[$entity_type_id]['bundles'] = $allowed_bundles;
}
$config
->set('interval', $form_state
->getValue('interval'))
->set('only_on_form_change', $form_state
->getValue('only_on_form_change'))
->set('active_on', $form_state
->getValue('active_on'))
->set('notification', $form_state
->getValue('notification'))
->set('allowed_content_entity_types', $allowed_content_entity_types)
->save();
parent::submitForm($form, $form_state);
}