Drupal is a registered trademark of Dries Buytaert
Release: Trash 3.0.31 Minor update available for module trash (3.0.31). Release: Editoria11y Accessibility Checker 3.0.8 Minor update available for module editoria11y (3.0.8). Usage Milestone: jQuery UI TouchPunch Module jquery_ui_touch_punch crossed 1,000 active installs. Release: UI Icons 2.0.0 Major update available for module ui_icons (2.0.0). Release: FlowDrop 2.0.0 Major update available for module flowdrop (2.0.0). Release: Smartling Connector for Drupal 8.x-9.26 Minor update available for module tmgmt_smartling (8.x-9.26). Release: Project Browser Localizer 3.0.6 Minor update available for module pb_localizer (3.0.6). Release: FileGate 1.6.1 Minor update available for module file_gate (1.6.1). Module Revived: MaxLength 3.2.0 Module maxlength updated after 11 months of inactivity (3.2.0). Usage Milestone: Forum Module forum crossed 10,000 active installs.

View Mode Switch Field

2,632 sites Security covered
View on drupal.org

This module allows content editors to choose a specific view mode for an entity when editing it. This is useful for displaying entities in different ways, such as an "Image + text" paragraph that can appear with the image on the left, right, or above the text. The module also allows for chained view mode switches and provides status reports for any misconfigurations.

This module provides a View mode switch field type that allows content editors to change specific view modes when editing an entity (see attached GIFs for short demonstrations).

Common use cases

  • You have an entity like a Paragraph (or any other fieldable entity type) which may be displayed in different variants (e.g. an "Image + text" paragraph that may be outputted with the image on the left, right or even above the text). With this field added to the entity and all appropriate view modes configured, content editors will be able to decide which view mode to use when displaying the entity.
  • You have entity listings where you want to be able to highlight specific items by using a different view mode for them.

Features

  • Both the origin view mode(s) and the view mode(s) allowed to switch to are configurable per field. You may even change these settings later, when there are already values available for a field.
  • A single View mode switch field may be used to apply the same view mode for one or more view modes (e.g. control the view mode to use for "Full" and "Preview" view mode simultaneously). If different origin view modes should be switched differently, just add any number of View mode switch fields to handle those separately.
  • View mode switches may be chained! Before outputting a view mode, it is always checked, if there is another field requesting a switch for that view mode (with recursion detection).
  • The site's status report informs about any misconfigured View mode switch fields (e.g. when all origin view modes were removed, that have been associated to a field).
  • Even though view mode switching happens "behind the scenes" with hook_entity_view_mode_alter(), it is also possible to output the field value via Field UI (e.g. for administrative previews) - either the view mode's machine name or its human-readable label.
  • Supports displaying field value differences between revisions via Diff module.
  • All code is thoroughly tested and automated tests are available for all functionality.

Similar modules

  • View Mode Selector (similar approach, but it only allows to switch a special view_mode_selector view mode)

Activity

Tracked releases
3
Tracked since
May 2026
Latest release
2 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
2.2.0 Stable May 6, 2026
3.0.0 Stable May 6, 2026
3.x-dev Dev May 5, 2026