
Drupal 10 Development Cookbook
By :

Many organizations have an editorial workflow that must be followed before content can be published on the website. The Content Moderation
module allows content created in Drupal to go through an editorial process before it is published. In this recipe, we will create a content moderation workflow that puts content in a draft state and then reviews, approves, and publishes it. The content remains in a draft state and is hidden from site visitors until it is published.
In this recipe, we will be using the standard installation, which provides the Article content type. Any content type will suffice.
Content Moderation
module and its dependent module, Workflows
:php vendor/bin/drush en content_moderation –yes
Without Content Moderation
, publishable content entities only have two states: unpublished or published. There also are no permissions to control who can make an unpublished piece of content published or vice versa. Content Moderation
solves this problem.
The Workflows
module provides an API for defining states and transitions. It is up to modules such as Content Moderation
to provide Workflow Type plugins to bring meaningful functionality. The Content Moderation
module integrates with the revision capabilities of Drupal content entities.
When editing a content entity that uses Content Moderation
, there will be a Moderation State field. This field contains the states that a piece of content can transition to, based on the current user’s permissions.
Drupal.org
: https://www.drupal.org/docs/8/core/modules/workflows/overview