Search code examples
drupaldrupal-7

Drupal 7, Entity Reference - display fields from referenced entity


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?


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