Commit 8e52db72 authored by alexpott's avatar alexpott

Issue #2404407 by effulgentsia:...

Issue #2404407 by effulgentsia: language_set_browser_drupal_langcode_mappings() is a useless wrapper, so remove it
parent f509e141
......@@ -444,19 +444,6 @@ function language_get_browser_drupal_langcode_mappings() {
return $config->get();
}
/**
* Stores language mappings between browser and Drupal language codes.
*
* @param array $mappings
* An array containing browser language codes as keys with corresponding
* Drupal language codes as values.
*/
function language_set_browser_drupal_langcode_mappings($mappings) {
$config = \Drupal::config('language.mappings');
$config->setData($mappings);
$config->save();
}
/**
* Implements hook_form_FORM_ID_alter for system_regional_settings().
*
......
......@@ -60,20 +60,17 @@ public function buildForm(array $form, FormStateInterface $form_state, $browser_
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$mappings = language_get_browser_drupal_langcode_mappings();
$this->config('language.mappings')
->clear($this->browserLangcode)
->save();
if (array_key_exists($this->browserLangcode, $mappings)) {
unset($mappings[$this->browserLangcode]);
language_set_browser_drupal_langcode_mappings($mappings);
$args = array(
'%browser' => $this->browserLangcode,
);
$args = array(
'%browser' => $this->browserLangcode,
);
$this->logger('language')->notice('The browser language detection mapping for the %browser browser language code has been deleted.', $args);
$this->logger('language')->notice('The browser language detection mapping for the %browser browser language code has been deleted.', $args);
drupal_set_message($this->t('The mapping for the %browser browser language code has been deleted.', $args));
}
drupal_set_message($this->t('The mapping for the %browser browser language code has been deleted.', $args));
$form_state->setRedirect('language.negotiation_browser');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment