How to Use the Workflows Module in Drupal 9

Big sites with lots of content and information often have multiple editors. That implies more control over the content. In an ideal world, the editors would write the content and publish it immediately. However, not everyone is so well-intentioned and mistakes can happen. 

The Workflows module for Drupal 9 provides moderation states for the content. That way, it is possible to establish transitions between these states. 

Example: from the state “Draft” to the state “First Revision” to the state “Published”.

The change between transitions is controlled by the default Drupal Permission System. In other words, a first-time editor with no trust bonus would not be able to publish his own content, but only to save a draft to be reviewed and approved by another editor with higher privileges.

This tutorial will explain the usage of the Workflows module.

Let’s start!

Step #1. – Enable the Required Modules

The modules we need are in Drupal core by default, we do not need to download anything.

  • Click Extend.
  • Type the search term “states” into the search box.
  • Enable Workflows and Content Moderation.
  • Click Install.

The Content Moderation module provides a default workflow with 3 predefined states. You can configure these moderation states with the Workflows module.

Step #2.- The Workflow Configuration

  • Click Configuration > Workflow > Workflows.

The Content Moderation module already provides a default workflow with 3 moderation states. 

  • Click the Edit button.
  • Scroll down and click the Select button beside the Content types option.
  • Select Article and click Save.
  • Scroll up and click on the “Add a new state” link.
  • Enter First revision for the state label.
  • Click Default revision.
  • Click Save.
  • Drag and drop the First Revision state under the Draft state.
  • Click Save.

Now, we should also add a transition to match the change from one state into another.

  • Click the “Add a new transition” link.
  • Give it a proper name.
  • Specify the change of state for this transition.
  • Click Save.
  • Drag and drop the transition under “Create new draft”.
  • Scroll down and click Save.
  • Edit the Publish transition to also match the First revision state.
  • Click Save.

The transitions section should look like this: 

Step #3.- Create Roles and Assign Permissions

  • Click People > Roles > Add role.

Add 2 roles, one for the simple writer and one for the controller. 
Edit the permissions for the Writer role.

  • Add the following permissions for the “Writer” role:

CONTENT MODERATION

Editorial workflow: Use Create New Draft transition.

View any unpublished content

View the latest version

FILTER

Use the Basic HTML text format

NODE

Article: Create new content

Article: Edit own content

Article: View revisions

Access the Content overview page

View all revisions

To view a revision, you also need permission to view the content item.

View all revisions

View published content

View own unpublished content

SYSTEM

View the administration theme

TAXONOMY

Access the taxonomy vocabulary overview page

TOOLBAR

Use the toolbar

  • Click Save Permissions.
  • Edit the permissions for the Controller role. 

The Controller should have the same permissions as the Writer plus the following ones:

CONTENT MODERATION

Editorial workflow: Use Archive transition.

Editorial workflow: Use First revision transition.

FILTER

Use the Full HTML text format

NODE

Article: Edit any content

Article: Revert revisions

Revert all revisions

Step #4.- Create Users

  • Click People > Add User.
  • Add one user for the Writer role and one for the Controller role.

Step #5. Create Content

  • Log out as admin and log back in as the “Writer” user.
  • Click Content > Add content > Article.
  • Write and save 2 articles.

Notice: the user with the “Writer” role is only allowed to save this article as “Draft”.

  • Log out and log back in as the ”Controller” user.
  • Click Content > Add Content > Article.
  • Write 2 articles as the ”Controller” user.

Notice: This user can save her articles with the state “First revision”.

  • Click Content to open the Content Overview.
  • Click Edit to edit one of the Writer’s articles.
  • Add some text and write a message for the Revision log.
  • Change the state to First revision.
  • Click Save.

Step #6.- Publish Content

  • Log in as the admin user.
  • Click Content.
  • Click Edit on a node.
  • Scroll down.

As you can see, the admin user has the faculty to put the node back in Draft state, or to publish it.

  • Select Published.
  • Click Save.

Checking the Moderated Content

  • Click Content > Moderated Content

You have here a list of all content that has been not moderated or requires additional moderation after an edit. 

Summary

The Workflows module for Drupal 9 allows site owners and content moderators to organize content and content publications, according to content moderation states and the corresponding transitions between them. 

I hope you liked this tutorial. Thanks for reading!

Instructor

  • Jorge lived in Ecuador and Germany. Now he is back to his homeland Colombia. He spends his time translating from English and German to Spanish. He enjoys playing with Drupal and other Open Source Content Management Systems and technologies.

0 0 votes
Blog Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x