function ContentEntityBase::getLanguages
3 calls to ContentEntityBase::getLanguages()
- ContentEntityBase::addTranslation in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - ContentEntityBase::getTranslationLanguages in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - 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 280
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([
'id' => $this->defaultLangcode,
]);
}
}
return $this->languages;
}