Problem/Motivation
If an entity instance has translations, only the original language link is fetched.
For example, if a node is originally written in spanish and has an english translation, when this content is referenced from another english node using ckeditor_entity_link, instead of the english path, the spanish one is retrieved.
Proposed resolution
Get the translated entity depending on the current viewed language and context Using entity.repository service.
Remaining tasks
A fix patch is included for review. I did some minor refactoring for related deprecated methods.
Greetings,
Comments
Comment #2
no74hAdded patch and did some refactoring
Comment #3
no74hComment #4
grimreaperHello,
Testing the patch.
Comment #5
grimreaperThis needs dependency injection but that's not the subject of this issue and you have done dependency injection for the new servie you use.
Tested without the patch, I have been able to reproduce the bug.
Tested with the patch applied. I confirm it solves the bug.
Thanks :)
Comment #6
no74hThank you Grimreaper.
I added a second patch to fix UndefinedLinkTemplateException related to file Entity. File Entity still doesn't implement toUrl in core.
'No link template 'canonical' found for the 'file' entity type '.
It's related to the previously added $entity->toUrl() in the first patch.
Thank you!
Comment #7
martinma commentedGreat work
Could reproduce the bug.
Applied patch #6 and it worked!
Linking to files worked too
Maybe batchfile without email header would make applying it more handy.
Comment #8
martinma commentedComment #9
dealancer commentedCan not apply this patch anymore to the current head.
Comment #10
mrinalini9 commentedRerolled patch #6 for 8.x-1.x branch, please review.
Comment #12
dealancer commented@mrinalini9 good job!
Comment #13
grimreaperHello,
@dealancer this is great that this issue had been fixed.
I only have two questions/remarks:
Comment #14
no74hHi, thank you all for the great work. Good Job!
Thanks @Grimreaper ;)