Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Entity Visibility Preview

Security covered Under active development 2 sites

Part of the Entity ecosystem · 310 projects

This module adds a field type that allows you to control access to content based on various conditions like date ranges or taxonomy terms. It provides a way to preview how your content will appear to users based on these configured conditions, and an optional submodule integrates this functionality with a grants API to check permissions in entity lists and views.

Synopsis

This module provides a new field type: entity visibility condition.

This new field allows to control the access to content entities (view operation not on admin routes). A plugin system allows to add new condition type.

Warning! The module implements hook_entity_access() so the access is checked only when this hook is triggered, for example on the page of a node. So if the content is displayed using a view for example, there is no access check.

A generic implementation of node_access hooks can't be done (if you have an idea on how to do a generic implementation open an issue and provide a patch ;)).

For now you are able to:

  • Add a new type field Entity Visibility Preview
  • Configure the field with selected plugins
  • Global configuration form
  • Preview the website depending on conditions

Use case

Add an entity visibility preview field on paragraphs. Contribute paragraphs with different date ranges and taxonomy categorizations. That way you can have a content displayed differently depending on time and the user categorization.

Entity Visibility Preview Simple Grants submodule

The Entity Visibility Preview Simple Grants submodule integrates the Entity Visibility Preview module with grant API.

Using the submodule will allow node lists (entity query, Views, Search API) to check permissions of current user according to taxonomies / current date.

The module works using the "preview" form of the Entity Visibility Preview module.

Warning! The Entity Visibility Preview Simple Grants submodule only connects the taxonomy condition and date range condition plugins with the grant API. Any other access plugin must be handled manually.

Demonstration

Watch a demonstration video

Requirements

Each condition plugin can require different modules, if the requirements are not satisfied the plugin doesn't show up in the field settings.

The Taxonomy condition plugin needs the following modules:

  • Taxonomy (Core)

The Date range condition plugin needs the following modules:

  • Datetime (core)

Configuration

  • Enable the Entity Visibility Preview module on your site.
  • Add an entity visibility preview field to an entity type.
  • Select the required visibility condition plugins on this field instance.
  • Configure if needed the plugins in the field settings.
  • Go to one content entity edit form where the field is added and configure visibility for this content.
  • Go to the configuration page (/admin/config/content/entity_visibility_preview/settings) and choose your module settings.
  • If you use the taxonomy condition plugin, you can go to a specific configuration page (/admin/config/content/entity_visibility_preview/taxonomy_condition) and choose your anonymous settings for each field on each entity type.
  • View your entity with the specific condition you just configured.

Credits

SVG icon eye.svg taken from Iconfinder and then modified.

Maintainers

Drupal 10–11

Ask your assistant about Entity Visibility Preview

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
3
Tracked since
Feb 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
2.0.x-dev Dev 10–11 Jun 25, 2024
8.x-1.10 Stable 10–11 Jun 19, 2024
8.x-1.9 Stable 9–10 Feb 27, 2023