public LanguageManager::getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE)
Returns a list of languages set up on the site.
int $flags: (optional) Specifies the state of the languages that have to be returned. It can be: LanguageInterface::STATE_CONFIGURABLE, LanguageInterface::STATE_LOCKED, or LanguageInterface::STATE_ALL.
\Drupal\Core\Language\LanguageInterface[] An associative array of languages, keyed by the language code.
Overrides LanguageManagerInterface::getLanguages
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 = array($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]; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Language!LanguageManager.php/function/LanguageManager::getLanguages/8.1.x