You are here

public function DomainLangNegotiationBrowserDeleteForm::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 NegotiationBrowserDeleteForm::submitForm

File

src/Form/DomainLangNegotiationBrowserDeleteForm.php, line 70

Class

DomainLangNegotiationBrowserDeleteForm
Builds a confirmation form to delete a browser language negotiation mapping.

Namespace

Drupal\domain_lang\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config($this->languageMappingsConfig)
    ->clear('map.' . $this->browserLangcode)
    ->save();
  $args = [
    '%browser' => $this->browserLangcode,
  ];
  $this
    ->logger('language')
    ->notice('The browser language detection mapping for the %browser browser language code has been deleted.', $args);
  $form_state
    ->setRedirect('domain_lang.negotiation_browser', [
    'domain' => $this->domainLangHandler
      ->getDomainFromUrl()
      ->id(),
  ]);
  $this
    ->messenger()
    ->addStatus($this
    ->t('The mapping for the %browser browser language code has been deleted.', $args));
}