Using EntityReference, how do I create a Drupal block that shows which nodes reference the current node?

StackOverflow https://stackoverflow.com/questions/10835727

Question

So let's say I have a node for a hotel and a node for a restaurant. I want a list of restaurant nodes that I have explicitly attached to the hotel node using EntityReference. Meaning, there is a field in the restaurant content type that refers to a hotel node.

It seems like I should be able to create a block view that will see what node the user is looking at, and show a list of related nodes, but I haven't been able to get it to work.

I have got a block that shows all restaurants, and have been trying to get contextual filters to work, but any time I try to create a contextual filter, I get this error: "An illegal choice has been detected. Please contact the site administrator." This seems like it should be simple, what am I doing wrong?

Was it helpful?

Solution

You will need contextual filters for this. I answered a question similar to this here: Way to display those nodes in a view that are related to any other node of a different type

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top