Displaying Node Titles Depending on Content Type Node

Events happening in the community are now at Drupal community events on www.drupal.org.
jessSchn's picture

I have two content types (product and case study). On the case study content type I have an entity reference to the product content type (the idea being that you can associate a case study to one or multiple products). Now I'm trying to setup a view (block) that will be placed in the sidebar of the product nodes. This view block will need to list case study node titles that have a reference to that product node.

I think I need to use Contextual Filters - but I'm not sure what settings I need - or maybe I need a relationship (too)? Any advice?

Comments

You'll need a contextual

mchris82's picture

You'll need a contextual filter set on the reference field pointing to the product.

To set it up, you'll want to select "Provide default value" and choose "Content ID from URL." The rest of the settings shouldn't need to be changed.

Great Tutorial

jessSchn's picture

Hey, I came across this link. I thought it'd be helpful to share.

http://www.webomelette.com/related-content-block-views-drupal-7

Glad you found a

mchris82's picture

Glad you found a solution!

That method adds the extra step of adding the relationship which I didn't think you'd need based on the view already being of the content type "case study." You should only really need the relationship if you want to pull additional information from the product the case study is referencing into the view i.e. fields on the product node itself, which would already be shown on the content being viewed.

Hope that makes sense.

Twin Cities

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: