function NegotiationBrowserDeleteForm::submitForm

Same name in other branches
  1. 9 core/modules/language/src/Form/NegotiationBrowserDeleteForm.php \Drupal\language\Form\NegotiationBrowserDeleteForm::submitForm()
  2. 8.9.x core/modules/language/src/Form/NegotiationBrowserDeleteForm.php \Drupal\language\Form\NegotiationBrowserDeleteForm::submitForm()
  3. 10 core/modules/language/src/Form/NegotiationBrowserDeleteForm.php \Drupal\language\Form\NegotiationBrowserDeleteForm::submitForm()

Overrides FormInterface::submitForm

File

core/modules/language/src/Form/NegotiationBrowserDeleteForm.php, line 67

Class

NegotiationBrowserDeleteForm
Defines a confirmation form for deleting a browser language negotiation mapping.

Namespace

Drupal\language\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->config('language.mappings')
        ->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);
    $this->messenger()
        ->addStatus($this->t('The mapping for the %browser browser language code has been deleted.', $args));
    $form_state->setRedirect('language.negotiation_browser');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.