protected ContentEntityBase::getLanguages()
File
- core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 238
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\Entity
Code
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;
}
Please login to continue.