I am using Drupal 8. I created a block (hotel) with the Views module, and I would like to add a reference to the block in content type's field, but only custom blocks can be added. The hotel block cannot be added to a new field because it was created with the Views module.

How can I add a reference to a views block to a field? Alternatively, how can I convert a views block in a custom block?

2 Answers 2


Both Views and Entity Reference are now part of the Drupal 8 core.

Go to
1) structure >views and create a view of type page or block. In another display select entity reference as display.
2) In format settings select the search fields for this view and select the fields you wish your view should display. Now save the view.
3) Go to structure > content types> Content type to which you want to add the reference field. Create and new field of type content, set the label you wish to and save and continue.
4) In type of item to reference select, "view". Save field settings.
5) In field settings, under reference type, select "Views: filter by an entity reference view". Under "View used to select the entities ", select your entity reference view and save.
6) In manage display of content type for this reference field you can select Link to entity or rendered entity. I had selected rendered entity and save the manage display settings.
7) Now create a content of your content type and in the entity reference field give the name of entity to which you want to refer to.


There is a module for this, Viewfield, which currently supports both Drupal 7 & 8 (alpha version).

Or use the stable D8 version of EVA, which has a different, more powerful approach by attaching a Views display to an entity, which then appears as a configurable field in the display mode of the entity.

Or simply add the View to a template variable, for example in a preprocess hook:

$variables['view'] = views_embed_view('hotel', 'block_display');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.