Problem/Motivation

I have a one-many relationship between two content types B and C implemented as B containing an entityreference field to C.
I have a one-one relationship between content types A and B implemented as A containing a single entityreference field to B .
I am using a Drupal core block view to list nodes of type C from any node of type B with a contextual filter set to: Provide default Value (content ID from URL)
This works fine when viewing the parent node of type B from its own page.
I want to be able to specify listing nodes of type C referenced by B which is in turn referenced by a node of type A.
This is not possible using Drupal core views functionality "Provide default value (content ID from URL" and I would like to know how to list C's contained in B's contained in A's

Steps to reproduce

Create content types A, B and C
Add an one-one entityreference B to A
Add a one-many entityreference C to B
Create a view to display C nodes in B
Note it works fine when viewing B
Create a node of type A containing a reference to node type B previously created
View A and note the view breaks as the URL now references node type A not B.

Proposed resolution

Add a new option in Views contextual filters to: Provide default value (content ID from parent node) in addition to the existing "content ID from URL". This would allow arbitrary layers of nesting.

Remaining tasks

TBD

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Syntapse created an issue. See original summary.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.