Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Entity Role View Mode Switcher

Security covered Under active development 31 sites

Part of the Entity ecosystem · 308 projects

This module allows you to control which view mode is displayed for an entity based on a user's role. You can set up rules that determine which view mode is shown, and then assign those rules to individual entities. This can be used for scenarios like creating a paywall where users with specific roles see full content while others see a teaser.

Allows the view mode to be switched based on the user's role per entity.

The purpose of this module is to define "Rules", like the one in the images below, that can be applied to individual entities.

Setup / Use Steps

  1. Define at least one View Mode Switcher Rule.
  2. Add an Entity Reference field to your node that references these rules.
  3. When you edit an entity you can select your "rule".

Whenever a visitor tries to view that entity (node) using the original view mode, the view mode may be switched based on their role.

Example Use Case

I have used this module to act as a paywall that will only allow users with a certain role to view certain "premium" articles. If they do not have the "premium" role they will be shown a teased version of the content when they try to view the article.

Drupal 8–11

Ask your assistant about Entity Role View Mode Switcher

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

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Aug 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Active

Releases

Version Type Core PHP Release date
2.1.0 Stable 8–11 May 1, 2025
2.0.0 Stable 8–10 Aug 23, 2023