3

Along with some regular nodes I want to link to a views page with an entity reference field.

Can I reference a views page via an entity reference field?

2

Can I reference a views page via an entity reference field?

Not out of the box, but you can use the Views reference field module to get that functionality:

In Drupal 8, Views are now identified as entities and the core Entity Reference Module is able to reference Views, however not Views displays. This module leverages core entity reference module functionality to add the display ID so that a View can be rendered in a field formatter.

  • Thank you for suggestion Clive. I don't think this will work for me on this occasion, as I need to reference regular nodes and some views pages side-by-side. However, it looks a very useful module and I expect I'll be able to make good use of it another time. – MrPaulDriver Jun 8 '18 at 15:00
1

No, the page itself is not an entity, each view is an object of class ViewExecutable which has different display names like page, block, page_1 and ... so the page itself is not an entity object (each entity has its own table and a unique identifier at least), hence you can use views_embed_view to get the result of a specific display of a view.

  • Thank you for the back ground Alireza. Not being a coder the views_embed_view method is probably not a suitable route for me. – MrPaulDriver Jun 8 '18 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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