4

I wonder how to insert any view inside of another view in Drupal 8?

Simply, we have products pages, which contains product details pages in views. When I click on any product detail page from view, it should open window with text which is set up in one view and display another second view with related receipts.

Both views should be filtered according to Taxonomy reference.

How can I achieve this?

4

OPTION 1

If you want to display it after your current view In Views, click on +Add button and select Attachment.

Now go to your page view in the FOOTER add Global: View area and select your attachment.

OPTION 2

Download and enable Twig Tweak

If you want this as a field, add a Global: Custom text and put:

<dd>{{ drupal_view('view_name', 'machine_name') }}</dd>

Ex: <dd>{{ drupal_view('frontpage', 'page_1') }}</dd>

OR

If you want to display it after your current view, in footer add Global: Text area, checkmark ☑ Use replacement tokens from the first row put <dd>{{ drupal_view('view_name', 'machine_name') }}</dd> and select FULL HTML as your text formatt.

1

I am not sure, if you need views inside view for your purpose. But there is a module for Views inside view,

Views Field View

There are a lot of cases in views where you want to embed a list inside each row. One example could be, you have a list of groups, and for each groups you want to list the first and last name of all of their members.

This can be achieved with this module, as views_field_view allows you to embed one view into another view and pass arguments along.

If you want some tutorial on that,

  1. Drupal Views Inside Other Views

  2. Create a View with Views inside in Drupal 7

  • thank you for the reply, but as I know that module is in beta version I need official save version – Peter Aug 5 '16 at 12:25

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.