public function BetterMessagesSettingsForm::submitForm in Better Messages 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/ BetterMessagesSettingsForm.php, line 273
Class
- BetterMessagesSettingsForm
- Admin settings form of the module.
Namespace
Drupal\better_messages\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('better_messages.settings');
$config
->set('position', $form_state
->getValue('pos'))
->set('fixed', $form_state
->getValue('fixed'))
->set('width', $form_state
->getValue('width'))
->set('horizontal', intval($form_state
->getValue('horizontal')))
->set('vertical', intval($form_state
->getValue('vertical')))
->set('popin.effect', $form_state
->getValue('popin_effect'))
->set('popin.duration', $form_state
->getValue('popin_duration'))
->set('popout.effect', $form_state
->getValue('popout_effect'))
->set('popout.duration', $form_state
->getValue('popout_duration'))
->set('autoclose', $form_state
->getValue('autoclose'))
->set('disable_autoclose', $form_state
->getValue('disable_autoclose'))
->set('show_countdown', $form_state
->getValue('show_countdown'))
->set('hover_autoclose', $form_state
->getValue('hover_autoclose'))
->set('opendelay', $form_state
->getValue('open_delay'))
->set('jquery_ui.draggable', $form_state
->getValue('draggable'))
->set('jquery_ui.resizable', $form_state
->getValue('resizable'))
->set('visibility', []);
foreach ($form_state
->getValue('visibility') as $condition_id => $values) {
// Allow the condition to submit the form.
$condition = $form_state
->get([
'conditions',
$condition_id,
]);
$condition
->submitConfigurationForm($form['visibility'][$condition_id], SubformState::createForSubform($form['visibility'][$condition_id], $form, $form_state));
$config
->set('visibility.' . $condition_id, $condition
->getConfiguration());
}
$config
->save();
parent::submitForm($form, $form_state);
}