public function SmartDateFormatSettingsForm::submitForm in Smart Date 8
Same name and namespace in other branches
- 8.2 src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
- 3.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
- 3.0.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
- 3.1.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
- 3.2.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
- 3.3.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
- 3.4.x src/Form/SmartDateFormatSettingsForm.php \Drupal\smart_date\Form\SmartDateFormatSettingsForm::submitForm()
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/ SmartDateFormatSettingsForm.php, line 33
Class
- SmartDateFormatSettingsForm
- Class SmartDateSettingsForm.
Namespace
Drupal\smart_date\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = \Drupal::service('config.factory')
->getEditable('smart_date_settings.settings');
foreach ($form_state
->getValues() as $key => $value) {
if (strpos($key, 'smart_date_format_') !== FALSE) {
$config
->set(str_replace('smart_date_format_', '', $key), $value);
}
}
$config
->save();
$this
->messenger()
->addMessage($this
->t('Configuration was saved.'));
}