public function NegotiationLanguageCookieForm::submitForm in Language Cookie 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/ NegotiationLanguageCookieForm.php, line 157
Class
- NegotiationLanguageCookieForm
- Configure the Language cookie negotiation method for this site.
Namespace
Drupal\language_cookie\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this->config
->set('param', $form_state
->getValue('param'))
->set('time', $form_state
->getValue('time'))
->set('path', $form_state
->getValue('path'))
->set('domain', $form_state
->getValue('domain'))
->set('secure', $form_state
->getValue('secure'))
->set('http_only', $form_state
->getValue('http_only'))
->set('set_on_every_pageload', $form_state
->getValue('set_on_every_pageload'));
/** @var \Drupal\language_cookie\LanguageCookieConditionInterface $condition */
foreach ($form_state
->get([
'conditions',
]) as $condition) {
$condition
->postConfigSave($this->config, $form, $form_state);
}
$this->config
->save();
// 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');
}