public function NegotiationLanguageSelectionPageForm::submitForm in Language Selection Page 8.2
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/ NegotiationLanguageSelectionPageForm.php, line 91 
Class
- NegotiationLanguageSelectionPageForm
- Configure the Language Selection Page language negotiation method.
Namespace
Drupal\language_selection_page\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  /** @var \Drupal\language_selection_page\LanguageSelectionPageConditionInterface $condition */
  foreach ($form_state
    ->get([
    'conditions',
  ]) as $condition) {
    $condition
      ->submitConfigurationForm($form, $form_state);
    if (\array_key_exists($condition
      ->getPluginId(), $condition
      ->getConfiguration())) {
      $this->config
        ->set($condition
        ->getPluginId(), $condition
        ->getConfiguration()[$condition
        ->getPluginId()]);
    }
  }
  $this->config
    ->save();
  /** @var \Drupal\language_selection_page\LanguageSelectionPageConditionInterface $condition */
  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');
}