This is an issue regarding the relationship "Node translation: Translations" and occurs when option "All" is selected. The Join that is created does not include untranslated nodes. But I would expect untranslated nodes to be part of "all languages" of themselves.
I tried to change the join into something like the following:
LEFT JOIN node node_node ON (node_node_data_field_XY.nid = node_node.tnid OR node_node.tnid = 0)
However, views does not support such complex joins. One can only append an AND restriction. I therefore turned the join into
LEFT JOIN node node_node ON node_node.tnid = node_node.tnid AND (node_node_data_field_XY.nid = node_node.tnid OR node_node.tnid = 0)
This is not as nice but it solves the issue. It adds untranslated nodes to the "All languages" relationship.
See my attached patch for my changes.
Thanks, Michael
Comment | File | Size | Author |
---|---|---|---|
#13 | views_884560_12-show-untranslated-nodes.patch | 3.37 KB | gnindl |
#6 | views_884560_6.patch | 1.78 KB | WorldFallz |
#3 | views_884560_3.patch | 1.77 KB | WorldFallz |
#2 | views-884560.patch | 1.77 KB | miruoss |
#1 | views-884560.patch | 1.64 KB | miruoss |
Comments
Comment #1
miruoss CreditAttribution: miruoss commentedHere comes the patch.
Comment #2
miruoss CreditAttribution: miruoss commentedMy approach was actually wrong, sorry! We don't want to have tnid=0 as it would add all those nodes. What we want to add to the "join ON" is node_node.nid=node_node_data_field_XY.nid. So finally the generated join would be
The new patch is attached.
Thanks, Michael
Comment #3
WorldFallz CreditAttribution: WorldFallz commentedseems reasonble. rerolled against 6-3 dev
Comment #4
WorldFallz CreditAttribution: WorldFallz commentedcorrecting version
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedCode style -- needs spaces around the concat operators. I know, in D6 standard Drupal doesn't have them there but that is an area of code style I have always deviated from Drupal and D7 changed in part because of my obstinance on the issue.
Comment #6
WorldFallz CreditAttribution: WorldFallz commentedi'm with you on that style element -- i usually catch those.
Comment #7
bojanz CreditAttribution: bojanz commentedSo we kill the IF surrounding the code block, but don't touch the indentation?
Also:
Seems not neded ;)
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedbojanz is right, we have to fix the indentation if we take that if out.
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedComment #10
dawehnerIn general this patch also doesn't apply anymore.
Comment #11
gnindl CreditAttribution: gnindl commentedPatch from #6 saved my day, patched version 2.16 successfully.
Comment #13
gnindl CreditAttribution: gnindl commentedI wasn't right there in comment #11. The extra SQL conditions are sanitized by Views due to a previous security patch probably. We have to render the SQL fragment manually as shown in the attached patch.
Comment #14
MustangGB CreditAttribution: MustangGB commented