function LanguageNegotiator::purgeConfiguration

Same name and namespace in other branches
  1. 9 core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::purgeConfiguration()
  2. 8.9.x core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::purgeConfiguration()
  3. 11.x core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::purgeConfiguration()

Resave the configuration to purge missing negotiation methods.

Overrides LanguageNegotiatorInterface::purgeConfiguration

File

core/modules/language/src/LanguageNegotiator.php, line 291

Class

LanguageNegotiator
Class responsible for performing language negotiation.

Namespace

Drupal\language

Code

public function purgeConfiguration() {
  // Ensure that we are getting the defined language negotiation information.
  // An invocation of \Drupal\Core\Extension\ModuleInstaller::install() or
  // \Drupal\Core\Extension\ModuleInstaller::uninstall() could invalidate the
  // cached information.
  $this->negotiatorManager
    ->clearCachedDefinitions();
  $this->languageManager
    ->reset();
  foreach ($this->languageManager
    ->getDefinedLanguageTypesInfo() as $type => $info) {
    $this->saveConfiguration($type, $this->getEnabledNegotiators($type));
  }
}

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