diff --git a/entity_translation.module b/entity_translation.module index 4150797..4a512d5 100644 --- a/entity_translation.module +++ b/entity_translation.module @@ -1627,7 +1627,9 @@ function entity_translation_get_handler($entity_type = NULL, $entity = NULL, $up if (!isset($handlers[$entity_type][$entity_id])) { $entity_info = entity_get_info($entity_type); $class = $entity_info['translation']['entity_translation']['class']; - $handler = new $class($entity_type, $entity_info, $entity, $entity_id); + // @todo remove fourth parameter once 3rd-party translation handlers have + // been fixed and no longer require the deprecated entity_id parameter. + $handler = new $class($entity_type, $entity_info, $entity, NULL); // If the entity id is empty we cannot cache the translation handler // instance. diff --git a/includes/translation.handler.comment.inc b/includes/translation.handler.comment.inc index 2b5ba24..b574f1d 100644 --- a/includes/translation.handler.comment.inc +++ b/includes/translation.handler.comment.inc @@ -11,8 +11,8 @@ */ class EntityTranslationCommentHandler extends EntityTranslationDefaultHandler { - public function __construct($entity_type, $entity_info, $entity, $entity_id) { - parent::__construct('comment', $entity_info, $entity, $entity_id); + public function __construct($entity_type, $entity_info, $entity) { + parent::__construct('comment', $entity_info, $entity); } /** diff --git a/includes/translation.handler.inc b/includes/translation.handler.inc index 5726ec8..502787e 100644 --- a/includes/translation.handler.inc +++ b/includes/translation.handler.inc @@ -305,14 +305,10 @@ class EntityTranslationDefaultHandler implements EntityTranslationHandlerInterfa * The entity information for the entity being wrapped. * @param $entity * The entity being wrapped. - * @param $entity_id - * The identifier of the entity being wrapped. */ - public function __construct($entity_type, $entity_info, $entity, $entity_id) { + public function __construct($entity_type, $entity_info, $entity) { $this->entityType = $entity_type; $this->entityInfo = $entity_info; - $this->entityId = $entity_id; - list(, , $this->bundle) = entity_extract_ids($entity_type, $entity); $this->setEntity($entity); $this->entityForm = FALSE; @@ -709,6 +705,9 @@ class EntityTranslationDefaultHandler implements EntityTranslationHandlerInterfa if (!isset($this->entity->{$translations_key})) { $this->entity->{$translations_key} = self::emptyTranslations(); } + + // Update bundle and entity id properties. + list($this->entityId, , $this->bundle) = entity_extract_ids($this->entityType, $this->entity); } /** diff --git a/includes/translation.handler.node.inc b/includes/translation.handler.node.inc index cd7545a..6d82175 100644 --- a/includes/translation.handler.node.inc +++ b/includes/translation.handler.node.inc @@ -13,8 +13,8 @@ */ class EntityTranslationNodeHandler extends EntityTranslationDefaultHandler { - public function __construct($entity_type, $entity_info, $entity, $entity_id) { - parent::__construct('node', $entity_info, $entity, $entity_id); + public function __construct($entity_type, $entity_info, $entity) { + parent::__construct('node', $entity_info, $entity); } /** diff --git a/includes/translation.handler.taxonomy_term.inc b/includes/translation.handler.taxonomy_term.inc index bb15b4c..800e106 100644 --- a/includes/translation.handler.taxonomy_term.inc +++ b/includes/translation.handler.taxonomy_term.inc @@ -11,8 +11,8 @@ */ class EntityTranslationTaxonomyTermHandler extends EntityTranslationDefaultHandler { - public function __construct($entity_type, $entity_info, $entity, $entity_id) { - parent::__construct('taxonomy_term', $entity_info, $entity, $entity_id); + public function __construct($entity_type, $entity_info, $entity) { + parent::__construct('taxonomy_term', $entity_info, $entity); } /** diff --git a/includes/translation.handler.user.inc b/includes/translation.handler.user.inc index bfc3a28..53b353b 100644 --- a/includes/translation.handler.user.inc +++ b/includes/translation.handler.user.inc @@ -11,8 +11,8 @@ */ class EntityTranslationUserHandler extends EntityTranslationDefaultHandler { - public function __construct($entity_type, $entity_info, $entity, $entity_id) { - parent::__construct('user', $entity_info, $entity, $entity_id); + public function __construct($entity_type, $entity_info, $entity) { + parent::__construct('user', $entity_info, $entity); } /**