diff --git a/includes/translation.handler.field_collection_item.inc b/includes/translation.handler.field_collection_item.inc new file mode 100644 index 0000000..f7f064c --- /dev/null +++ b/includes/translation.handler.field_collection_item.inc @@ -0,0 +1,57 @@ +bundle != $entity_info['translation']['entity_translation']['default_scheme']) { + $this->setPathScheme($this->bundle); + } + } + + /** + * {@inheritdoc} + */ + public function getAccess($op) { + return field_collection_item_access($op, $this->entity); + } + + /** + * {@inheritdoc} + */ + public function getLanguage() { + $langcode = $this->entity->langcode() ? $this->entity->langcode() : LANGUAGE_NONE; + // Use the field language as entity language. + if ($langcode == LANGUAGE_NONE) { + // 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->getFormLanguage(); + } + // If the host entity is not translatable, use the default language + // fallback. + else { + $langcode = parent::getLanguage(); + } + } + return $langcode; + } + +}