public function EntityTranslationDefaultHandler::getLanguage in Entity Translation 7
Overrides EntityTranslationHandlerInterface::getLanguage
See also
EntityTranslationHandlerInterface::getLanguage()
9 calls to EntityTranslationDefaultHandler::getLanguage()
- EntityTranslationDefaultHandler::entityForm in includes/
translation.handler.inc - EntityTranslationDefaultHandler::entityFormLanguageWidget in includes/
translation.handler.inc - EntityTranslationDefaultHandler::getFormLanguage in includes/
translation.handler.inc - Retrieves the active form language.
- EntityTranslationDefaultHandler::getSharedFieldsAccess in includes/
translation.handler.inc - EntityTranslationDefaultHandler::getTranslationAccess in includes/
translation.handler.inc
1 method overrides EntityTranslationDefaultHandler::getLanguage()
File
- includes/
translation.handler.inc, line 833 - Default translation handler for the translation module.
Class
- EntityTranslationDefaultHandler
- Class implementing the default entity translation behaviours.
Code
public function getLanguage() {
if (!empty($this->entityInfo['entity keys']['language'])) {
$language_key = $this->entityInfo['entity keys']['language'];
if (!empty($this->entity->{$language_key})) {
return $this->entity->{$language_key};
}
}
$translations = $this
->getTranslations();
if (!empty($translations->original)) {
return $translations->original;
}
else {
// When we are creating an entity and no language is specified fall back
// to the default language for the current entity and bundle.
return $this
->getDefaultLanguage();
}
}