Steps to reproduce:
* Enable Content Translation.
* Add a language (eg: French).
* Enable translation for a content type, eg: Page.
* Add some content, and translate it. I created nodes "Dog" (en) and "Chien" (fr).
* Add a view over your content type, with a page display, showing a table of fields.
* Add a field to the view "Link to Content".
* Look at the view output. Hover your cursor over the French link, notice it goes to an English path. See LinkResult.png
There's some code in LinkBase::addLangCode() that sounds like it should be relevant, but I see no evidence that it actually does anything. It looks like cruft left over from an old implementation. @dwehner in IRC agreed.
I guess we should add in EntityTranslationRenderTrait to LinkBase.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | 2667086-20.patch | 11.68 KB | aerozeppelin |
| #17 | interdiff-2667086-12-17.txt | 4.37 KB | aerozeppelin |
| #17 | 2667086-17.patch | 11.65 KB | aerozeppelin |
| #12 | 2667086-12.patch | 11.48 KB | aerozeppelin |
| #12 | interdiff-2667086-9-12.txt | 7.49 KB | aerozeppelin |
Comments
Comment #2
vasi commentedComment #3
vasi commentedComment #4
vasi commentedComment #7
vasi commentedComment #8
dawehnerLooks perfectly, now we just need some additional test coverage
Comment #9
aerozeppelin commentedTests for #7.
Comment #11
dawehnerThank you @aerozeppelin for trying to write a test!
This test coverage does many things which are unrelated with the bug. a) It uses the UI to create nodes b) it uses the UI to configure the view and c) it uses the UI to look at the view. For faster and more safe tests we should a) Create the article via API b) Provide a preconfigured view and c) visit this view path rather than the preview.
Comment #12
aerozeppelin commentedHopefully this is an improvement over #9.
Comment #13
dawehnerOh yes, this is much better!
Do we need this?
Comment #14
aerozeppelin commentedI am assuming, we need it to load the pre reconfigured view.
Comment #15
dawehnerSorry for being annoying, to be clear, this functionality is not about
views_uibut rather about views itself, so ideally the test would live inside views. There you can still load the pre-configured view, when you use theViewTestBaseclass.Comment #17
aerozeppelin commentedNo worries, you are not being annoying. :D Thank you for taking your time out to critique my code, it helps me learn. Here is an attempt to write tests using ViewTestBase class.
Comment #19
dawehnerSadly the patch doesn't apply :(
Comment #20
aerozeppelin commentedUpdated the patch for 8.1.x.
Comment #22
ckaotikLooks good so far! There's one thing we should keep in mind, though, and that is the access check in
checkUrlAccess.I suspect this will lead to incorrect results when e.g. the translation source is published (= access granted) but the displayed translation is unpublished and the user doesn't have access to such unpublished entities.
getUrlInfo()is implemented by the inheriting field plugins (e.g. EntityLink) and only uses$this->getEntity(). Thus,$url->getRouteParameters()contains the (source) language, so I'd guess we could fix this by overriding this?Comment #31
quietone commentedThis was fixed in a later issue #2877994: Entity Links fields does not have translation support. I am closing this as a duplicate and moving credit over to the other issue.
If that is wrong, reopen the issue, by setting the status to 'Active', and add a comment.
Thanks!