At the moment entity_translation expects menu arguments to be a entity load token. Ex. "%node" vs "%".

In most cases this works great, but when attempting to integrate another module as ECK that does not declare a load callback for it's variable entity types then various entity_translate callbacks will attempt to make do with the id causing unexpected results.

I propose that when an id is passed to the handler that we go ahead and load the entity via entity_load and use a new method for the translation handler $handler->getEntity(); so that we don't have this issue when '%' is used over '%LOAD_CALLBACK'.

Files: 
CommentFileSizeAuthor
#7 entity_translation-add_support_no_load_tokens-1866076-7.patch2.96 KBgrndlvl
PASSED: [[SimpleTest]]: [MySQL] 681 pass(es).
[ View ]
#6 entity_translation-add_support_no_load_tokens-1866076-6.patch2.97 KBgrndlvl
PASSED: [[SimpleTest]]: [MySQL] 681 pass(es).
[ View ]
#1 entity_translation-add_support_no_load_tokens-1866076-1.patch3.04 KBgrndlvl
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_translation-add_support_no_load_tokens-1866076-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new3.04 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_translation-add_support_no_load_tokens-1866076-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Category:support» feature

Looks sensible to me, thanks.

+++ b/entity_translation.admin.inc
@@ -204,6 +204,10 @@ function entity_translation_overview($entity_type, $entity, $callback = NULL) {
+  // In some cases the entity passed as an argument is not an entity, however,
+  // the handler is smart enough to figure this out so let's just ask the handler
+  // for the usable entity.

Can we have a shorter comment, but everywhere we do this? Something like: "Ensure $entity holds an entity object and not an id."

Status:Needs review» Needs work

The last submitted patch, entity_translation-add_support_no_load_tokens-1866076-1.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new2.97 KB
PASSED: [[SimpleTest]]: [MySQL] 681 pass(es).
[ View ]

Re-roll against 7.x-1.x

StatusFileSize
new2.96 KB
PASSED: [[SimpleTest]]: [MySQL] 681 pass(es).
[ View ]

Adding changes mentioned in #2.

Looks good to go to me. Can anyone confirm this is working with ECK?

Status:Needs review» Reviewed & tested by the community

Yes, we use it in combination with eck

Status:Reviewed & tested by the community» Fixed

Committed and pushed, thanks.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.