You are here

public function DomainLangNegotiationUrlForm::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 NegotiationUrlForm::submitForm

File

src/Form/DomainLangNegotiationUrlForm.php, line 180

Class

DomainLangNegotiationUrlForm
Configure the URL language negotiation method for this site.

Namespace

Drupal\domain_lang\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Save selected format (prefix or domain).
  $this
    ->config($this->languageNegotiationConfig)
    ->set('url.source', $form_state
    ->getValue('language_negotiation_url_part'))
    ->set('url.prefixes', $form_state
    ->getValue('prefix'))
    ->set('url.domains', $form_state
    ->getValue('domain'))
    ->save();
  $form_state
    ->disableRedirect();
  $this
    ->messenger()
    ->addStatus($this
    ->t('The configuration options have been saved.'));
}