Question

I'm using Entity Reference to link two content types: "Job Postings" and "Jobs".

"Job Postings" have an Entity Reference field called "Job Title", which references the "Job Title" field of a "Job". When you create a Job Posting, you select a Job that it references.

When I display a Job Posting, I want to display fields from the referenced Job. This would seem to be a pretty basic requirement. But how do I do this?

I tried creating a View with a Relationship based on the Entity Reference and a Contextual Filter based on Nid, but it never works.

What approaches have you used that work for this scenario?

Was it helpful?

Solution

I finally figured it out!

On the view: FILTER CRITERIA Content: Type (= Job Posting)

RELATIONSHIPS Entity Reference: Job Title Content entity referenced from field_job_title

OTHER TIPS

In Drupal 6, I've used the reference views module to create field formatters for referenced nodes that go beyond the default title, node, etc.

In D7, you can use Entity Reference Views Formatter to do the same thing. Here's some more info: https://drupal.org/node/700950#comment-7298028RV

There is much easier way to make it using DS module. In the manage display section of the Job posting type just check display as teaser. And in the Job type just make the the display you want as a teaser. In this case you can reuse this display in other places.

Love DS module.

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