getDefaultLockedLanguages example

/** * {@inheritdoc} */
  public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE) {
    $static_cache_id = $this->getCurrentLanguage()->getId();
    if (!isset($this->languages[$static_cache_id][$flags])) {
      // If this language manager is used, there are no configured languages.       // The default language and locked languages comprise the full language       // list.       $default = $this->getDefaultLanguage();
      $languages = [$default->getId() => $default];
      $languages += $this->getDefaultLockedLanguages($default->getWeight());

      // Filter the full list of languages based on the value of $flags.       $this->languages[$static_cache_id][$flags] = $this->filterLanguages($languages$flags);
    }
    return $this->languages[$static_cache_id][$flags];
  }

  /** * {@inheritdoc} */
  public function getNativeLanguages() {
    
$static_cache_id = $this->getCurrentLanguage()->getId();
    }

    if (!isset($this->languages[$static_cache_id][$flags])) {
      // Initialize the language list with the default language and default       // locked languages. These cannot be removed. This serves as a fallback       // list if this method is invoked while the language module is installed       // and the configuration entities for languages are not yet fully       // imported.       $default = $this->getDefaultLanguage();
      $languages = [$default->getId() => $default];
      $languages += $this->getDefaultLockedLanguages($default->getWeight());

      // Load configurable languages on top of the defaults. Ideally this could       // use the entity API to load and instantiate ConfigurableLanguage       // objects. However the entity API depends on the language system, so that       // would result in infinite loops. We use the configuration system       // directly and instantiate runtime Language objects. When language       // entities are imported those cover the default and locked languages, so       // site-specific configuration will prevail over the fallback values.       // Having them in the array already ensures if this is invoked in the       // middle of importing language configuration entities, the defaults are       // always present.
Home | Imprint | This part of the site doesn't use cookies.