You are here

public function ConfigurableLanguageManager::reset in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/ConfigurableLanguageManager.php \Drupal\language\ConfigurableLanguageManager::reset()

Resets the given language type or all types if none specified.

Parameters

string|null $type: (optional) The language type to reset as a string, e.g., LanguageInterface::TYPE_INTERFACE, or NULL to reset all language types. Defaults to NULL.

Return value

\Drupal\Core\Language\LanguageManagerInterface The language manager that has been reset.

Overrides LanguageManager::reset

File

core/modules/language/src/ConfigurableLanguageManager.php, line 246
Contains \Drupal\language\ConfigurableLanguageManager.

Class

ConfigurableLanguageManager
Overrides default LanguageManager to provide configured languages.

Namespace

Drupal\language

Code

public function reset($type = NULL) {
  if (!isset($type)) {
    $this->initialized = FALSE;
    $this->negotiatedLanguages = array();
    $this->negotiatedMethods = array();
    $this->languageTypes = NULL;
    $this->languageTypesInfo = NULL;
    $this->languages = array();
    if ($this->negotiator) {
      $this->negotiator
        ->reset();
    }
  }
  elseif (isset($this->negotiatedLanguages[$type])) {
    unset($this->negotiatedLanguages[$type]);
    unset($this->negotiatedMethods[$type]);
  }
  return $this;
}