ervms
Give content editors the power to choose how each referenced entity displays. This module adds a "View Mode" selector to entity reference fields, allowing different view displays (teaser, card, full, etc.) to be selected per-item without duplicating content.
Features
- Per-item view mode selection: Choose a different view display for each entity in a multi-value reference field
- Per-bundle allowed view modes: Restrict which view modes are available to editors on a per-bundle basis — e.g., only offer "Card" and "Full" for one paragraph type while offering "Teaser" and "Default" for another, all on the same field
- Content editor friendly: Simple dropdown appears below each entity reference selection in the editing form
- Dynamic options: Available view modes update automatically based on the referenced entity's bundle
- Works with existing view displays: Uses your already-configured view modes - no extra setup required
- Paragraph support: Optional submodule (ervms_paragraphs) adds support for paragraph reference fields
- Nested field support: Works with entity reference fields inside paragraphs
- CSS classes included: Formatters add view-mode-specific classes for easy theming
Example use case: You have a "Related Content" field that references articles. Some articles should display as teasers, others as cards, and others as full content - all within the same field on the same page, without creating duplicate content or building complex Views.
Post-Installation
Configuration requires two steps:
Step 1: Enable on your field
- Go to Structure > Content types > [Your Type] > Manage fields
- Edit your entity reference field
- Find the "View Mode Selector" fieldset and check "Enable view mode selector"
- Save
Step 1b (optional): Restrict allowed view modes per bundle
- On the same field settings page, expand the "View Mode Selector" fieldset
- When enabled, collapsible groups appear for each target bundle
- Check specific view modes to restrict what editors see for that bundle
- If none are checked for a bundle, all view modes are shown
- "Default" is configurable per bundle and can be excluded
Step 2: Configure the display formatter
- Go to Structure > Content types > [Your Type] > Manage display
- Change your entity reference field's formatter to "Entity Reference View Mode"
- For paragraph fields, use "Paragraph View Mode" formatter instead
- Save
The view mode selector will now appear when editing content. Only view displays that are enabled on the target entity type will be available as options, further filtered by any per-bundle restrictions you configured.
Additional Requirements
- Drupal 10 or 11
- Field module (Drupal core)
- For paragraph support: Entity Reference Revisions module (required by Paragraphs)
Recommended modules
- Paragraphs - If you're using paragraph-based content, enable the included ervms_paragraphs submodule for full paragraph support including nested entity references and compatibility with the Paragraphs widget's collapsible interface
- Entity Reference Field Override - Companion module by Click Here Labs that lets editors override specified fields in referenced entities within the reference context, without changing the referenced entities.
Similar projects
- Display Suite - Provides extensive display management but at the field level rather than per-reference-item. Does not allow selecting different view modes for individual items within a single field.
- View Mode Field - Allows selecting a view mode for the current entity being edited, not for referenced entities.
- Entity View Fallback - Handles fallback logic when view modes don't exist, but doesn't provide editor selection.
This module is unique in providing per-item view mode selection directly in the content editing experience, giving editors granular control over how each referenced entity renders.
Supporting this Module
This module is maintained by Click Here Labs. If you find it useful, consider:
- Contributing issues and patches
- Writing documentation or tutorials
- Sponsoring development of new features
Community Documentation
- Full documentation available in the module's README.md file
- API functions for programmatic access to view mode data
- Troubleshooting guide included for common issues