0

Drupal 7

  1. Is it possible to get the current pages Node name and dynamically use it for a view using node reference? I have a content type called product and I am going to add a view to this content type that will show a list of image content types that have a node reference field set to the product content type.

For example:

"Furniture" page - content type "Product"
"Clothing" page - content type "Product"

"Image" content type - "Image 1" w/ a node reference field of "Furniture"
"Image" content type - "Image 2" w/ a node reference field of "Clothing"
"Image" content type - "Image 3" w/ a node reference field of "Clothing"
"Image" content type - "Image 4" w/ a node reference field of "Furniture"

So when I go to the Furniture product page my view will have Image 1 and Image 4 in the list and if I got to Clothing product page it will show Image 2 and Image 3.

If this needs more explanation please let me know.

1
  • It will easy to do, if you use taxonomy for your categories, like clothing.
    – Codium
    Commented Aug 14, 2011 at 9:51

1 Answer 1

2

First add the node reference field as a relationship. That will enable the node reference field to be added as a contextual filter.

You can use EVA module to attach the view to your node page, which will automatically pass the node ID to the view (which your contextual filter should pick up and show only images referencing that node).

You can checkout Is there a good tutorial for "Entity Views Attach Module"? for more info on EVA

1
  • Great I will take a look at the tutorial. +1
    – Denoteone
    Commented Aug 14, 2011 at 21:21

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.