Needs work
Project:
Translated Entity Reference
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2016 at 13:01 UTC
Updated:
23 May 2018 at 12:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
Koen.Pasman commentedComment #3
Koen.Pasman commentedComment #4
anybodyI can absolutely confirm this problem!
i18n_node_i18n_context_language() has "entityreference" as result of arg(0) and can't be used for this case, as it seems!
The module does not work at all for parent entity language.
Comment #5
anybodyThe "q" parameter looks like this instead (node edit):
de/entityreference/autocomplete/single/field_xyz/node/article/873/MyEnteredAutocompleteSearch
(Node add:)
de/entityreference/autocomplete/single/field_xyz/node/article/NULL/MyEnteredAutocompleteSearch
where arg(0) is entityreference.
A $_GET['translation'] parameter is NOT available in this command.
Comment #6
anybodyFinally this module is not able to work as expected currently for the described situation. I have no idea how to solve that or how that ever worked.
Comment #7
sleepingmonkChanged to i18n_language_content() and added a join (entity_translation) to the query to include referenced items that are also translated into the target language.
Comment #8
sleepingmonkRealized that changing to i18n_language_content() did basically the same as setting the field to "Select all nodes matching interface language".
Removed that change and made the or/join conditional on the existence of entity_translation.
Added the or/join to the query condition for "Select all nodes matching interface language" setting as well.
(This may now be a different issue.)
Comment #9
sleepingmonkAfter further discussion with my colleagues, I've added the change to i18n_language_content() back in for "parent language", given that the parent language for the node being referenced will be the current content language, and i18n_node_i18n_context_language() won't work on the autocomplete field.
This patch also still contains the check for entity_translation and additional join to return results if referenced nodes have translations in the correct language.
Comment #10
anybodyi18n_language_content() will not return the selected content language, will it?
It will return the current site language of the acting user?
Comment #11
chrlvclaudiu commentedI agree with #10. I've tested solution #9 and doesn't seem to work.
Comment #12
chrlvclaudiu commentedHey, why not using the entity's language in this case ? I've attached a patch and any tests would be great.
Comment #13
rcodina@hrlvclaudiu Your patch doesn't work for me because I use "Internationalization" and "Content Translation" to translate my site. I think a patch must support both ways of translation (Content Translation and Entity Translation). Also, notice the module dependencies on info file.
Comment #14
rcodinaComment #15
Nodz commentedThe patch in #12 worked for me, but I only use "Internationalization" on that site.
It makes sense however that the solution would be optimal if it was aware of both ways of translation.
Comment #16
sleepingmonkWhen checking entity translation table, the handler did not filter results by entity_type = node, which would return nodes of the wrong language in the autocomplete field, because other entities existed with matching entity ids.
This latest patch adds the condition to resolve this issue.
Comment #17
sleepingmonkComment #18
Koen.Pasman commentedHm, sleepingmonks patch works for me if I remove the condition on et.entity_type. Needs some further testing though.
Comment #19
rcodinaI think that if you use Entity Translation you don't need this module, you just need to update Entity Reference module to latest version. Am I wrong? Check this out #1674792: Rendered entity is not language aware
Comment #20
matthieu_collet commentedyes #17 patch is working for me too when removing the condition on et.entity_type
and yes @rcodoina, I still need this module even if I use Entity Translation