You are here

public function DomainLangNegotiationBrowserForm::submitForm in Domain Lang 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 NegotiationBrowserForm::submitForm

File

src/Form/DomainLangNegotiationBrowserForm.php, line 175

Class

DomainLangNegotiationBrowserForm
Configure the browser language negotiation method for this site.

Namespace

Drupal\domain_lang\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $mappings = $form_state
    ->get('mappings');
  if (!empty($mappings)) {
    $config = $this
      ->config($this->languageMappingsConfig);
    $config
      ->setData([
      'map' => $mappings,
    ]);
    $config
      ->save();
  }
  $form_state
    ->disableRedirect();
  $this
    ->messenger()
    ->addStatus($this
    ->t('The configuration options have been saved.'));
}