0

I have 3 contenttypes where 2 of them have reference entity fields. Each their own entityfield.

Contenttype C is the parent. Type B points to type C. Type A points to B.

On every Node of type C i want to display a view that lists the nodes of type A pointing to B, that points to C. Is this possible?

Help appreciated.

  • Have you tried this overview drupal.org/node/1841004 it only uses two content types but a third could be thrown in there. It's a little tricky to get setup at first but works pretty well. Although it may not work since you have C->B->A but may be a start. – burnsjeremy Jan 21 '15 at 23:09
1

Create a view that filters C nodes. Go to view advanced options and add a relationship with the field in B which references A and choose Referencing entity. Give a name name "children" to this relationship. Then create another relationship based on the field in A that references B. For this relationship use the previous relationship. Name this one grandchildren. Last add fields you need from the A nodes and dont forget to use relationship grandchildren for each one.

Alternatively use node A as base table and use the referring entity relationship type. Now you want to check require relationship to emulate an inner sql join and thus filter out B and C nodes with no references

|improve this answer|||||
0

I can't easily think of a way offhand. I see 2 options. I would try option 2 first (it's a bit easier).

  1. Try to use the Relation module and attached fields to relation(s) and use the Relations within Views.
  2. Another option I did for something similar is use Computed Field to store meta-data I needed to make Views reporting a little easier. For example in your scenario I might add a Computed Field on Node Type C that stores a list of related Node Ids in a comma seperated list like: "234,543,875". You would write custom PHP code that could use an EntityFieldQuery to find the NIDs of the related content you want and save that list as a string of IDs. Then you could add a field of Views Field on Node Type C that renders a View of related content that passes as an argument the NID list as a token from the computed field.

Your example (lists of related, related things) is something I always find tricky to do -- through trial and error I have come to see trying to add meta-data to my relationships (like option 1 or 2 above) make working with the data easier.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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