public Entity::language()
Gets the language of the entity.
\Drupal\Core\Language\LanguageInterface The language object.
Overrides EntityInterface::language
public function language() { if ($key = $this->getEntityType()->getKey('langcode')) { $langcode = $this->$key; $language = $this->languageManager()->getLanguage($langcode); if ($language) { return $language; } } // Make sure we return a proper language object. $langcode = !empty($this->langcode) ? $this->langcode : LanguageInterface::LANGCODE_NOT_SPECIFIED; $language = new Language(array('id' => $langcode)); return $language; }
© 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!Entity!Entity.php/function/Entity::language/8.1.x