public function NegotiationLanguageAdministrationLanguageNegotiationForm::submitForm in Administration Language Negotiation 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/ NegotiationLanguageAdministrationLanguageNegotiationForm.php, line 92
Class
- NegotiationLanguageAdministrationLanguageNegotiationForm
- Class NegotiationLanguageAdministrationLanguageNegotiationForm.
Namespace
Drupal\administration_language_negotiation\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
foreach ($form_state
->get([
'conditions',
]) as $condition) {
$condition
->submitConfigurationForm($form, $form_state);
if (isset($condition
->getConfiguration()[$condition
->getPluginId()])) {
$this->config
->set($condition
->getPluginId(), $condition
->getConfiguration()[$condition
->getPluginId()]);
}
}
$this->config
->save();
foreach ($form_state
->get([
'conditions',
]) as $condition) {
$condition
->postConfigSave($form, $form_state);
}
// Redirect to the language negotiation page on submit (previous Drupal 7
// behavior, and intended behavior for other language negotiation settings
// forms in Drupal 8 core).
$form_state
->setRedirect('language.negotiation');
}