Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.6.17 Update released for Drupal core (10.6.17)! Release: Linkit 7.0.17 Minor update available for module linkit (7.0.17). Release: Raven: Sentry Integration 7.6.0 Minor update available for module raven (7.6.0). Release: Geocoder 8.x-4.36 Minor update available for module geocoder (8.x-4.36). Release: Copyright Footer 3.4.0 Minor update available for module copyright_footer (3.4.0). Release: Shortcode Gmap 3.0.1 Minor update available for module shortcode_gmap (3.0.1). Release: IDNA Convert Service (punycode) 2.0.6 Minor update available for module idna (2.0.6). Release: IDNA Convert Service (punycode) 2.0.5 Minor update available for module idna (2.0.5). Usage Milestone: Schemata Module schemata crossed 1,000 active installs. Module Revived: Backlinks Index 1.1.5 Module backlinks_index updated after 7 months of inactivity (1.1.5).

View Mode Switch Field

2,607 sites Security covered Drupal 11 · not 10
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 like node, media, taxonomy term, user, etc.) 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

Depends on

Dependencies of the latest stable release

  • field Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

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

Release Timeline

Releases

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