protected function ContentEntityBase::getLanguages in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::getLanguages()
3 calls to ContentEntityBase::getLanguages()
- ContentEntityBase::addTranslation in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Adds a new translation to the translatable object.
- ContentEntityBase::getTranslationLanguages in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Returns the languages the data is translated to.
- ContentEntityBase::language in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Gets the language of the entity.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 241 - Contains \Drupal\Core\Entity\ContentEntityBase.
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\EntityCode
protected function getLanguages() {
if (empty($this->languages)) {
$this->languages = $this
->languageManager()
->getLanguages(LanguageInterface::STATE_ALL);
// If the entity references a language that is not or no longer available,
// we return a mock language object to avoid disrupting the consuming
// code.
if (!isset($this->languages[$this->defaultLangcode])) {
$this->languages[$this->defaultLangcode] = new Language(array(
'id' => $this->defaultLangcode,
));
}
}
return $this->languages;
}