Entity Reference Views are one way you can make life easier for Drupal content creators.
Normally, when people are creating content on your site, each field consists of a single box with a single data point. For example, in a list of people, you might get only the person's name.
Entity Reference Views allows you to provide far more information. For example, you can add photos and personal details to your list of people.
Entity Reference Views in Drupal 7
In this example, I have a content type called "Presentations" and another content type called "Speakers". Every time I add a presentation, I want to choose from a list of speakers.
- Install and enable Views and Entity Reference.
- Go to Structure > Views > Add new view.
- Create a view of the content that you want content editors to choose from. In this example, I'm going to make a list of "Speakers":
- At the top of the page, click "Add" then "Entity Reference":
- Click "Settings" next to "Entity Reference list".
- Search fields: Choose the field you want users to search by.
- Click "Apply (this display)".
- Check the preview to make sure your view is working ...
Step #2. Add a Field with the Entity Reference View
- Go to Structure > Content types.
- Add an "Entity Reference" field.
- Target type: Choose to link to nodes, users, files or whatever else you want to display.
- Mode: Choose "View: Filter by an entity reference view."
- View used to select the entities: choose the view you created.
- Click "Save field settings".
- Click "Add content" and the data entry for your field will use the View you created:
Entity Reference Views Widget
Entity Reference Views in Drupal 8
Both Views and Entity Reference are now part of the Drupal 8 core.
To use Entity Reference Views in Drupal 8, the process is easy.
- Create a view, as we showed above.
- Go to Structure > Content types > Add field.