0

I have three node content types, called 'pathway', 'page' and 'relation'. The relation nodes I use to connect pages to the pathways. The relation nodes have entity reference fields: endpoint A and endpoint B. I want to create a views block of all relation nodes, which use endpoint A reference (pathway) to referene the same patway as the relation that references the currently viewed node using endpoint B.

The purpose of the block is to show all relations of the pathway on every page that is referenced by one of these relations.

enter image description here

2
  • Are you using regular Entity Reference fields or something else? Can you explain better what you're trying to list and where?
    – prkos
    Commented May 24, 2021 at 2:51
  • Entity reference fields
    – Yuri
    Commented Jun 15, 2021 at 14:57

1 Answer 1

0

If I understand correctly, you want a Views block such that, when I am on the "Node Q" page, the view traverses the relationships all the way up to Pathway "Node X", and then down again to "Relation 1", "Relation 2", and "Relation 3".

Start with a Contextual Filter "Content: ID", configured with a default value to get the Content ID from the URL. This will provide the view with "Node Q" as a starting point.

Next, we need to add a chain of relationships, each one dependent on the last.

  • Add a Relationship "Content using [Endpoint B field]". This connects "Node Q" to "Relation 1". I suggest setting the relationship's administrative title to something more precise, like "Relation from node".
  • Add a Relationship "Content referenced from [Endpoint A field]", configured to use the previous "Relation from node" relationship. This connects "Relation 1" to "Pathway X". Again, set a better administrative title, like "Pathway from relation".
  • Add a Relationship "Content using [Endpoint A field]", configured to use the previous "Pathway from relation" relationship. This connects "Pathway X" to all the Relations referencing it in Endpoint A. Set an adminstrative title like "Relations from pathway".

This should get you there. When configuring your View's fields, make sure to use the "Relations from pathway" relationship.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.