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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hctom created an issue. See original summary.

hctom’s picture

Title: "Content with term" relationship not working due to wrong base table » "Content with term" views relationship not working due to wrong base table
hctom’s picture

And here is the proposed patch

Ramya Balasubramanian’s picture

Issue tags: +#ChennaiDrupalGroup
FileSize
137.78 KB
73.39 KB

I 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 .

hctom’s picture

Issue summary: View changes

@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?

hctom’s picture

dawehner’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

It would be really nice to have some test coverage here. The actual bugfix is looking great!

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

matsbla’s picture

Issue tags: +views

I've tested the patch and can confirm it solves the issue.

YesCT’s picture

Issue tags: -

I 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.

joelstein’s picture

This is such an obvious bug and such a simple fix. Worked perfectly for me.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

szeidler’s picture

hctom’s picture

Status: Needs work » Closed (outdated)
Related issues: +#3011013: Taxonomy 'related content' views relationship links to wrong base table.

@szeidler: You are right... the other issue fixes it already. So this can be closed