public function SimpleMailSettingsController::submitForm in Simple Mail 8
Same name and namespace in other branches
- 2.0.x src/Controller/SimpleMailSettingsController.php \Drupal\simple_mail\Controller\SimpleMailSettingsController::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 ConfigFormBase::submitForm
File
- src/
Controller/ SimpleMailSettingsController.php, line 92
Class
- SimpleMailSettingsController
- Returns responses for Simple Mail module routes.
Namespace
Drupal\simple_mail\ControllerCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('simple_mail.settings');
$storage = $form_state
->getStorage();
// Save all the Simple Mail configuration items from $form_state.
foreach ($form_state
->getValues() as $key => $value) {
if (in_array($key, $storage['keys'])) {
$config
->set($key, $value);
}
}
$config
->save();
// Tell the user the settings have been saved.
drupal_set_message(t('The configuration options have been saved.'));
}