You are here

public function EntityTranslationFieldCollectionItemHandler::getLanguage in Field collection 7

Overrides EntityTranslationDefaultHandler::getLanguage

See also

EntityTranslationHandlerInterface::getLanguage()

File

includes/translation.handler.field_collection_item.inc, line 38
Field Collection Item translation handler for the Entity Translation module.

Class

EntityTranslationFieldCollectionItemHandler
Field Collection Item translation handler.

Code

public function getLanguage() {

  // Do not use $this->entity->langcode() as this will finally call
  // field_collection_entity_language() which again calls us!
  // If the current field is untranslatable, try inherit the host entity
  // language.
  if (($host_entity_type = $this->entity
    ->hostEntityType()) && entity_translation_enabled($host_entity_type) && ($host_entity = $this->entity
    ->hostEntity())) {
    $handler = $this->factory
      ->getHandler($host_entity_type, $host_entity);
    $langcode = $handler
      ->getLanguage();
  }
  else {
    $langcode = parent::getLanguage();
  }
  return $langcode;
}