public function SettingsForm::submitForm in Layout Builder Base 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 293
Class
- SettingsForm
- Class SettingsForm.
Namespace
Drupal\layout_builder_base\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$newconfig = $this->configFactory
->getEditable(static::SETTINGS);
$values = $form_state
->getValues();
$tabs = [
'default_values',
'override_options',
];
$properties = $this
->getProperties();
foreach ($tabs as $tab) {
foreach ($properties as $property => $infos) {
$value = $values[$tab][$infos['group']][$property];
$config_name = $tab === 'default_values' ? $property : self::getOverrideConfigName($property);
$newconfig
->set($config_name, $value);
}
}
$newconfig
->save();
}