Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to display in a view all available languages for a node translated with entity translation.
The only way I found to do it is to add a language selector to the entity relationship. If it is the only way I would find useful to add a language selector to the entity translation relationship.
Comment | File | Size | Author |
---|---|---|---|
#4 | views_export-nodes_translations_ok.txt | 23.26 KB | nikosnikos |
#4 | views_export-nodes_translations_ko.txt | 24.19 KB | nikosnikos |
#1 | entity_translation-relationship_language_selector-1888982-1.patch | 1.88 KB | nikosnikos |
Comments
Comment #1
nikosnikos CreditAttribution: nikosnikos commentedHere's a patch that add the language selector
Comment #2
fabsor CreditAttribution: fabsor commentedThe patch works fine, but couldn't you just add a filter on entity_translation.language after adding the relationship instance to achieve the same thing? I would like to avoid adding filtering functionality on the relationship if it's not necessary.
Also, a small review:
Instantiate the array before using it ($join->extra = array())
Comment #3
nikosnikos CreditAttribution: nikosnikos commentedThanks fabsor for the code and functionality review.
I tried to do what you say : create a relationship with entity_translation and filter this relationship with the language. But it had no effect (or not the one I was expected, I don't remember). Nevertheless, your review make me think that it should have work (I wasn't really sure about that) I have to make some more tests to see where there's something wrong...
Comment #4
nikosnikos CreditAttribution: nikosnikos commentedOK, here's my use case.
I want to display a views with these rows :
So I add three relationships with entity_translation for each languages (fortunately I only have three languages)
If I use filter to say to each relation in which language I want it, the rows are these :
There's only those that are translated in the three languages.
Now if I use my patch, I have what I want.
I attach, my views exports. The first (views_export-nodes_translations_ok.txt) will only work with my patch, the second, should work without my patch.