public function ContentEntityBase::language in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::language()
- 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::language()
Gets the language of the entity.
Return value
\Drupal\Core\Language\LanguageInterface The language object.
Overrides EntityBase::language
2 calls to ContentEntityBase::language()
- ContentEntityBase::hasTranslationChanges in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Determines if the current translation of the entity has unsaved changes.
- ContentEntityBase::isLatestTranslationAffectedRevision in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Checks whether this is the latest revision affecting this translation.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 716
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\EntityCode
public function language() {
$language = NULL;
if ($this->activeLangcode != LanguageInterface::LANGCODE_DEFAULT) {
if (!isset($this->languages[$this->activeLangcode])) {
$this
->getLanguages();
}
$language = $this->languages[$this->activeLangcode];
}
else {
// @todo Avoid this check by getting the language from the language
// manager directly in https://www.drupal.org/node/2303877.
if (!isset($this->languages[$this->defaultLangcode])) {
$this
->getLanguages();
}
$language = $this->languages[$this->defaultLangcode];
}
return $language;
}