Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

cached_moderation_state

1,660 sites Security covered
View on drupal.org

Introduction

Drupal's content moderation module uses a computed field to allow developers to access an entity's current state, but this approach has a major shortcoming: computed fields can't be used in entity queries. This module aims to provide a workaround that facilitates interoperability between entity query conditions and an entity's state.

How it works

This module provides a custom field, cached_moderation_state, that copies an entity's moderation_state field value before the entity is saved. This field is automatically added to all moderated entity bundles when the module is first installed and any time a workflow is updated, but it must be initialized for each moderated entity before first use.

For a more detailed explanation of how this module works, click here.

Installation and setup

Please consult the installation guide for more detailed instructions. Generally, the following steps are required to start using this module:

  1. Make the module available for installation via Composer or direct download.
  2. Enable the module via Drupal's module installation interface, Drush, or a hook_post_update_NAME() implementation in a dependent module.
  3. Initialize the cached_moderation_state field on all moderated entities.

After initial setup, you can use the cached_moderation_state field in entity queries.

Planned obsolescence

This module's ultimate goal is to be obsoleted by a change to Drupal core that would allow an entity's moderation state to be accessed using entity queries. We encourage everyone to help fulfill this goal by contributing to the following issue: #3025164: Provide a way for fields with computed or custom storage to decide how to impact entity queries.

Activity

Total releases
2
First release
Feb 2025
Latest release
1 month ago
Release cadence
394 days
Stability
100% stable

Releases

Version Type Release date
1.1.2 Stable Mar 11, 2026
1.1.1 Stable Feb 10, 2025