Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to construct a page template where I display node information in the content area, and some views in a sidebar that display data from another node type. I am using the Entity Reference module. I am displaying apartment units, and these unit content types have a many-to-one relationship to its community complex. So, when the user views the unit profile, its community data will pop up on the side.

Anyone know the best way to go about doing this?

share|improve this question
up vote 1 down vote accepted

Have a node_reference field in the content type Apartment Unit.

Use node id from content as the contextual filter.

Use the node_reference field as a relationship in the view that you create. When you go to the fields section now(after adding the relationship), now you can add the fields from the referenced community complex.

share|improve this answer
Should I install the References module and not the Entity Reference module? I removed the reference I had from the community content type and added it to the apartment unit type. So, when we add a new unit, we'll just select the community it belongs to. However, the contextual filter doesn't seem to work. I set the filter to the field (that resides in the Community content type). – vintorg Dec 24 '12 at 20:09
My bad, I have updated the description. – Gokul N K Dec 24 '12 at 20:13
That worked! Thanks Gokul!! – vintorg Dec 24 '12 at 20:28
Actually, I spoke too soon. All apartment units are showing up for any community. – vintorg Dec 24 '12 at 20:50
On a apartment page, you wanted to display the data regarding community right? – Gokul N K Dec 24 '12 at 21:01

I figured it out. In the view, in Relationships, choose Entity Reference: Referencing Entity. Click 'Require this relationship'. Next, add a Contextual filter for Content:Nid. Under Relationship, select the ID you set up in Relationships.

For 'When the filter is NOT available', select 'Provide default' with 'Content ID from URL'. Below that, for when filter IS available, select Validator.

That worked for me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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