Providing an Entity Reference result View
The Entity reference field, covered in Chapter 2, The Content Authoring Experience, can utilize a custom view for providing the available field values. The default entity reference field will display all available entities of the type it can reference. The only available filter is based on the entity bundle, such as only returning Article nodes. Using an entity reference view, you can provide more filters, such as only returning the content that your user has authored.
In this recipe, we will create an entity reference view that filters content by the author. We will add the field to the user account form, allowing users to select their favorite contributed content.
How to do it...
- Go to
Structureand thenViews. This will bring you to the administrative overview of all the views that have been created. Click onAdd viewto create a new view. - Set the
View nametoMy Content Reference View, and retain the currentView settingsconfiguration. - Do not choose...