0

I am using Drupal 7 an have three content types: A, B and C. A references to B, B references to C. Now I would like to display a block on nodes of content type A of the following form:

B1

--C1

--C2

--C3

B2

--C4

--C5

--C6

...

I get as far as to display this on a node of content type A:

B1

B2

by adding a Relationship "Entity Reference: A bridge to the Content entity that is referenced via B"

and a Contextual Filter based on the above relationship set to "Content ID from URL".

How can I now manage to display the C content which is referenced by the relevant B content?

Any help much appreciated! Thank you!

andir
  • 1
  • 1
  • One way would be to load Cs from you view template file. Inside your B node variable you have array of C ids so you can loop trough it and load Cs... – MilanG May 05 '15 at 07:11
  • @MilanG Thanks for your reply. What shall I use a template file for, in this context? – andir May 09 '15 at 10:29

2 Answers2

0

How did you reference the nodes? If you use the 'node reference module' you will just be able to display the referenced nodes as you would any other field.

https://www.drupal.org/project/references

0

As I said, open your view for editing, unfold "Advanced" region on most right column and click "Theme: information" at bottom of that column. Depending on view here you'll see maybe 4 or 5 template files and name suggestions.

First name is a link "Dispaly name", "Style output" and when clicked you can see default template code. But not only that - you can copy that code into your editor and edit it as you like. Of course keep main parts, like writing out values view's query gets.

Then, when you are done editing, pick some name to save that template. Some name of name suggestions after link you clicked to get that code. The name shown is bold is currently used. Depending on name you select your template can be used for more or few view....or just a single view. On left are names used more and the more you go right they are more and more specific.. (just for some view, just for some display and so on...).

After that save your template file, upload (copy) it to /sites/all/themes/your_theme/templates and clear the cache. You also have that "Rescan template files" that can do the same job.

If everything is well (you named file correctly and save it at right location and cleared the cache) your new template name will be shown bold in Theming information popup instead of previous one.

https://api.drupal.org/api/views/theme!theme.inc/group/views_templates/7

MilanG
  • 6,994
  • 2
  • 35
  • 64