What is Entity Reference?
The term “Entity Reference” literally means reference to the entity. Entities are used to store data, which could be a node, a user, a taxonomy term, or a custom drupal development.
Entity Reference is an important module to build relationships between entities in Drupal. Below are some of the examples of relationship:
1) A taxonomy term associated with a user account.
2) A parent content that references a child content element.
How to use Entity Reference?
Below are the steps to use entity reference in Drupal 8.
Step1: Create settings related to Entity Reference module from backend.
Step2: Create Content type.
Step3: Add/Edit fields of content type through Home -> Administration -> Structure -> Content Types -> Content type (ie:user) -> Manage fields, Add a new Entity Reference field.
Step4: Choose the number of values.
Step5: Set Entity Reference type.
Step6: Select Entity Reference method.
Step7: Set the target bundles.
Step8: For Views: Filter by an entity reference view and follow screen-shots, below.
As we complete above steps – you can view changes in front as well.
What is Entity Reference View?
For Drupal content creators, Entity Reference Views is a great way to make content management easier.
Normally, when users create content on the site, each field is very plain. However, Entity Reference Views allows you to provide for more information. For example, instead of just showing a list of users, your content creators can browse through a list of names, photos and personal details.
How to use Entity Reference View?
Steps to use Entity Reference View in Drupal 8.
1) Create a content View.
2) Add a field with the Entity Reference View.
Below are the steps that combine steps of Entity Reference and Entity Reference View explained with screenshots.
1) Create Content Type:
2) Add Entity Reference field:
3) Create Entity Reference View to use it as Entity Reference and set it as Entity Reference in Reference method:
4) Create another Entity Reference View:
5) Add Entity Reference while creating Entity Reference View:
6) Change Reference Type from default to views: Set entity reference view (created in step4) in Reference method while setting reference type.
Hope the article helps you how to use Entity reference module in your project. If you need help or have any follow up questions, please don’t hesitate to contact us @ email@example.com. cmsMinds is a drupal web development company in Raleigh,NC, based in Raleigh with expertise in open source CMS (WordPress, Drupal) and PHP.