Problem/Motivation
Currently the "Content with term" relationship does not work properly. Steps to reproduce:
- Create a new content view
- Add "Taxonomy terms on node" relationship to get all referenced terms
- Add "Content with term" relationship using before create relationship to get all content tagged with these terms
- Try to add e.g. a "Content: Title" field using the "Content with term" relationship -> No relationships are present!
Digging through the code, I found, that the $data['taxonomy_index']['nid']
relationship definitions is using node
instead of node_field_data
as base table. This may have been fogotten at #2429447: Use data table as views base table, if available.
Proposed resolution
Create a patch that changes the base table of the above noted relationship definition
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#4 | screenshot-localhost 2016-02-27 14-07-22.png | 73.39 KB | Ramya Balasubramanian |
#4 | screenshot-localhost 2016-02-27 14-06-58.png | 137.78 KB | Ramya Balasubramanian |
#3 | content_with_term_-2674832-3.patch | 569 bytes | hctom |
Comments
Comment #2
hctomComment #3
hctomAnd here is the proposed patch
Comment #4
Ramya Balasubramanian CreditAttribution: Ramya Balasubramanian commentedI was new to Drupal . I checked this issue Hereby I have attached screenshots of my view. This is working for me without applying any patch .
Comment #5
hctom@Ramya Balasubramanian: You have to try to add the "Content with term" relationship ("node" in your case) for your fields (see last entry in steps to reproduce). I guess you won't be able to do so, right?
Comment #6
hctomComment #7
dawehnerIt would be really nice to have some test coverage here. The actual bugfix is looking great!
Comment #14
matsbla CreditAttribution: matsbla at Globalbility commentedI've tested the patch and can confirm it solves the issue.
Comment #15
YesCT CreditAttribution: YesCT at Lullabot for IBM commentedI ran into this today. Patch from #3 still works. :)
What might be a good test to start with?
Is there a similar test I could copy and change for this situation?
Or is there an existing test I could add some steps/assertions to?
Any hints would help.
Comment #16
joelstein CreditAttribution: joelstein commentedThis is such an obvious bug and such a simple fix. Worked perfectly for me.
Comment #18
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedLooks like this was fixed in #3011013: Taxonomy 'related content' views relationship links to wrong base table.. Can someone confirm?
Comment #19
hctom@szeidler: You are right... the other issue fixes it already. So this can be closed