This module allows you to embed one Drupal view inside another, creating a nested display. It achieves this by adding configured child views as fields to parent views, passing contextual filters from the parent row to the child view to ensure relevant data is shown. This is useful for displaying related content in a structured way, such as listing group members within a list of groups.
The Views Field View module is a powerful tool for site builders who need to create nested data structures. It allows you to embed one view as a field within another, creating a "view-within-a-view" architecture that handles complex relationships with ease.
How It Works
The module provides a specialized field handler for Drupal Views. When you add this field to your "Parent" view, you can select a "Child" view to display inside it. Most importantly, it allows you to pass contextual filters (arguments) from the parent row - such as a Node ID or User ID - directly into the child view to ensure the embedded data is relevant to that specific row.
A Common Use Case: Nested Memberships
Example: building a directory of Groups. In main list, you want to show the group's name and description, but you also want to display a sub-list of the first and last names of all members belonging to that specific group.
- The Parent View: Lists the Groups.
- The Child View: Lists User names, filtered by a Group ID.
- The Connection: Views Field View passes the Group ID from the parent row into the child view’s contextual filter.
Performance & Caching
Because nesting views can be resource-intensive (as it triggers additional database queries for every row in your list), caching is highly recommended. To keep your site fast and responsive, consider using advanced caching strategies:
- Views Content Cache: Automatically clears the view cache when specific content types are updated.
- Cache Actions: Provides Rules integration to trigger cache clearing based on specific site events.