You are here

public function EntityTranslationTaxonomyTermHandler::getLanguage in Entity Translation 7

Overrides EntityTranslationDefaultHandler::getLanguage

See also

EntityTranslationDefaultHandler::getLanguage()

File

includes/translation.handler.taxonomy_term.inc, line 21
Taxonomy term translation handler for the entity translation module.

Class

EntityTranslationTaxonomyTermHandler
Taxonomy term translation handler.

Code

public function getLanguage() {
  if (isset($this->entity->vid) && module_exists('i18n_taxonomy')) {
    $mode = i18n_taxonomy_vocabulary_mode($this->entity->vid);

    // We support also terms having no translation enabled, since they can
    // just be language-aware.
    if ($mode == I18N_MODE_NONE || $mode == I18N_MODE_ENTITY_TRANSLATION) {
      $translations = $this
        ->getTranslations();
      if (!empty($translations->original)) {
        return $translations->original;
      }
    }
  }
  return parent::getLanguage();
}