Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

View Mode Switch Field

Security covered Under active development 3,433 sites

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

Drupal 11 · not 10

Ask your assistant about View Mode Switch Field

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
10
Tracked since
Feb 2023
Latest release
1 month ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
3.0.1 Stable 11 Sep 30, 2026
2.2.0 Stable 10 May 6, 2026
3.0.0 Stable 11 May 6, 2026
3.x-dev Dev 11 May 5, 2026
2.1.1 Stable 10–11 Sep 12, 2024
2.1.0 Stable 10–11 Aug 27, 2024
2.0.8 Stable 10 May 31, 2024
2.0.7 Stable 9–10 Feb 10, 2024
2.0.6 Stable 9–10 Jan 8, 2024
2.0.5 Stable 9–10 Feb 10, 2023