1
votes

I have some content types with the same reference field. The main content type is A B, C and D content types has a node_reference field to content type A. (URL pathes are A for Content type A, A/B for Content type B, A/C for content type C, and A/D for content type D, so the block can be visible in A/*)

I want to list in a block at node pages (of B, C and D content types) the title of all items with the same A references. So, when I'm on A/C node page I'd like to list all items, that is referenced the same A such as C.

I tried with many relationships (Required relationship for that field) and contextual filters (Content: NID, Content: field_A, many validation) but I didn't find the good solution. And I didn't find example for this problem. Can anyone help me (concrete example, url, idea)?

1

1 Answers

2
votes

Ok, I solved :) Only use Contextual Field -> Content:NID with default value (Content ID from URL) On fields I add field_A rendered as NodeID, and excluded from diplay and I added a Global PHP (instead of simple titles)

<?php print views_embed_view('{viewname}', '{viewdisplay}', $data->field_field_A[0]['raw']['nid']); ?>

The embedded views use contextual filter for field_A and list titles with a blocktitle (Different block for different content types) to group elements.