Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Easy and Effective Content Moderation in Drupal 9 (With an Example!)

Parent Feed: 

Editorial process and workflow is critical regardless of your content marketing strategy - is an easy thing to type. Sure, it can give your team better clarity and enable them to work in sync… Yes, a strategic editorial workflow can save you from deciphering email strings and searching Slack messages for who is handling what… Of course we all know that multiple hands working on it from different locations, things can get pretty complex… Yet, how many organizations, years deep into content marketing, still have a non-existent workflow? Way more than need to. Especially with Drupal 9 offering a fantastic module - the Content Moderation module - that allows editorial teams to manage and build workflows for specific types of content. 

By default, as most people are accustomed to in basic setups, Drupal content can be either published or unpublished. If your content marketing team needs something a little more nuanced than this, enable the Workflows and Content moderation modules for Drupal 9. (Note that the content moderation module became a core module after Drupal 8.5) That makes it easier than ever to create an editorial workflow that works for your team. In this article we’ll illustrate how these modules work.

Drupal 8 has now reached EOL. If you’re still on Drupal 8, now is the time to migrate to Drupal 9.

Content Moderation

Content Moderation and Workflow Modules for Drupal 9

The Drupal 9 Content moderation module works in conjunction with the Workflows module to easily create and manage an editorial workflow using different states and transitions. The Content moderation module allows you to:

  1. Create a Draft (The first state is not published)
  2. Have different states than just published and unpublished.
  3. Change the states.
  4. Have granular permission control for every transition and state.
  5. Select the content types that you want to apply the workflow to

The Workflows module defines a set of states and transitions that are then attached to content by the Content moderation module. A “state” is the current condition that your content is in (Draft, Unpublished, Review, Published, Archive). A “transition” is the process of moving content from a state to another (Needs work, Needs review, Publish).

Configuring Content Moderation

First, let’s get your Content moderation module enabled. Content moderation module ships with Drupal core, but is disabled by default. You will need to manually enable the module to start working with it. 

To enable the module, go to Extent -> Content Moderation module and Click on Install. 
Once the module has been enabled,
go to Configuration -> Workflow -> Workflows

Here, you can see a default workflow called “Editorial” that gets created when you enable the module. You can edit the existing “Editorial” workflow or create a new workflow by clicking on Add Workflow.

Add new workflow

Creating a new workflow

Once you have created a new workflow, you will see various states and transitions that you can configure and edit. You can also create your own state or transition if your team requires more flexibility or steps. There’s also the option for you to choose the content type that you want to apply this workflow to.

Editorial Workflow

Defining a new Workflow

Label: The name of the Workflow.

States: You can add a new state by clicking on the  “Add a new state” button like “Ready for Review” or “Approved”. You can also edit an existing state.

Transitions: You can add a new transition by clicking on the “Add a new transition” button. For Example: Transition from Ready For Review -> Approved

This workflow applies to: You can choose to which entity types the workflow should apply. For example, Block types, Content, etc.

Default Moderation State: Here you can choose the default moderation state when we create a new content.

Users and Permissions

Now, let’s say you are working in a team of 3 :

  1. Blog Author: The person who creates and edits the Blog but does not publish the Blog.
  2. Blog Reviewer: The person who reviews the Blog created by the Blog Author.
  3. Blog Publisher: The person who publishes the blog approved by the Blog Reviewer

Assuming that you have created user profiles for these three users, let’s move on to what each one of them can do (or not do).

The site admin controls what each user can access and sets permissions for them. For this example, we have chosen Blog post as our content type and named the workflow “Blog”. The site admin can give access to each user to control each transition created for this workflow. You can see that here (see below) we have given the Blog Author the permission to only Create New Draft, while the Blog Publisher has permissions for almost everything (Approve, Archive, Create New, Needs work, Publish). The Blog Reviewer can control the Approve, Create new draft and move to Needs work transitions.

Permission Control

Permission control example for a Blog post content type

The Workflow Example

Here is an example of the content moderation workflow for a Blog post content type.

1. Blog Author creates a new blog post.

New blog post

2. The Blog Author saves the content in Draft because the article is not ready to be published yet.

Draft

3. Once the Blog Author completes writing the blog, they will change the state from Draft to Ready For Review.

Ready for Review

4. The Blog Reviewer reviews the content and if everything is ok, they will change the state from Ready for Review to Approved.

Approved

5. If the Blog needs work and is not ready to be Approved, he  will change the state from Ready for Review to Needs Work.

Needs Work

6. The Blog Publisher publishes the Blog post. They change the moderation state of the content from Approved to Published.

Published

This example shows a simple editorial workflow of a blog post content type. You can also have a more complex and rich workflow based on your business requirements.

To check and edit the status of all your content - moderation state, content revisions, author, content type, etc., you can do this in your Moderated content view. You will only find this view when the Content moderation module is enabled. To find it, go to Content -> Moderated Content tab.

Moderated content dashboard
Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web