1

I want to embed a view in content of type basic page in D8. How to I do that. Insert View module is still not stable to be used in D8.

1
  • There are many ways of doing this, often using contrib modules that don't have stable releases. You need to tell us more about the relationship you want between the content and the view. Is the view always identical? Is it the same view, but filtered by a property of the content? Or do you want editors to be able to select a different view on each entity?
    – Jonathan
    Sep 20, 2016 at 11:05

2 Answers 2

2

You might want to have a look at Paragraphs and some of the new Views Reference fields. You could then intersperse Views and content.

https://www.drupal.org/project/paragraphs

https://www.drupal.org/project/viewsreference

0

You can use views_embed_view() function

\Drupal::service('renderer')->render(views_embed_view('VIEW_NAME'));

Where VIEW_NAME is the name of your view.

2
  • This isn't very ideal unless you're hardcoding placement in templates.
    – Kevin
    Sep 19, 2016 at 10:17
  • The optional second parameter to views_embed_view will let you set the display name. Sep 23, 2016 at 15:24

Your Answer

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

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