Drupal 8 - EVA - Attach User view as a field to a node

By xngo on July 3, 2019

Entity Views Attachment(EVA) is a module that allows you to attach the output of a View to the content of any Drupal entity. In this tutorial, I will show you how to attach the output of a User view as a field to a node.

Create Users view

Setting screenshot for User view

Setup EVA view to display on specific content type

  • Add EVA display.
    • Setting screenshot to add EVA
  • Add any fields that you want to display. For example,
    • Example of fields to display
  • Under ENTITY CONTENT SETTINGS section, set Entity type to Content.
  • Set the Bundles to Article.
    • Setting screenshot of entity content settings

Link EVA view to node

Now that your User view is created, you have to ensure that the view only displays the user informations that are specific to the selected node. To accomplish this, you have to add a relationship to the node and filter by the node ID. Here is how.

  • Expand the ADVANCED section.
  • Add User: Content authored relationship.
    • Setting screenshot for relationship
  • Add the Content: ID contextual filter.
    • Setting screenshot for context filter

Move EVA field to desired position

After your EVA view is created, an EVA field is also created in your selected content type. You can now navigate to the Manage display field tab to change the order position of your EVA field. In my case, I navigate to Structure > Content types > Article > Manage display and then move the EVA: About author - EVA field to the position that I like. EVA field in Manage display tab

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.