public function SettingsForm::submitForm in Simplifying 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 FormInterface::submitForm
File
- src/
Form/ SettingsForm.php, line 104
Class
Namespace
Drupal\simplifying\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$menu_links = $form_state
->getValue('menu_links');
$menu_links = array_filter($menu_links);
$this->settingsactions
->setSettings('menu_links', array_keys($menu_links));
$entity_fields = $form_state
->getValue('entity_fields');
$entity_fields = array_map('array_filter', $entity_fields);
$this->settingsactions
->setSettings('entity_fields', $entity_fields);
$toolbar_tabs = $form_state
->getValue('toolbar_tabs');
$this->settingsactions
->setSettings('toolbar_tabs', $toolbar_tabs);
$design = $form_state
->getValue('design');
$this->settingsactions
->setSettings('design', $design);
$this
->messenger()
->addStatus($this
->t('Settings saved successfully'));
}