Overview

Last updated on
28 January 2018

The Content Moderation module allows you to expand on Drupal's "unpublished" and "published" states for content. It allows you to have a published version that is live, but have a separate working copy that is undergoing review before it is published. This is achieved by using Workflows to apply different states and transitions to entities as needed.

Configuration

Enabling the Content Moderation module creates a default Workflow called "Editorial" that can be used for custom block types or content types. You can use the default settings, or customize the workflow configuration. From here, there are also some additional steps necessary in order to use Content Moderation.

Entity type changes

This feature requires Drupal 8.4 or later. Once your moderation workflows are established, you can apply the workflows to different entity types. Out of the box Content Moderation can be added to Block Content and Content (Node) entities. The "select" button will allow you to select which content types should use this workflow. Note that Basic page is checked in the screen shot so it makes sense to the Sample workflow described in this document.

Page Content Type under moderation

Permissions

You will probably allow people with roles other than administrator to participate in the workflow. To achieve this, you will need to set up the proper permission schema at People > Permissions. 

Role permissions

The schema in the image above, is centered around two roles; Author and Editor. In this example, an Author can create and edit content, but not publish content. To publish content, the Author will need to save the content as a Draft. Then a user with the Editor role can review the content, and either save it as Published, or save it as a Draft.

Be sure to grant 'View the latest version' and subsequently 'View own unpublished content' to authors. Otherwise authors will not be able to view their latest changes.

Below is a sample of appropriate Node permissions for this example. Note the Author role has permission to create and edit own Basic pages, as well as viewing and reverting revisions, while the Editor role has additional permissions to allow editing of any Basic page, as well as deleting. Your workflow may not match this example exactly, but it is demonstrative of one scenario.

Node Permissions

Now that our permissions are configured, let's create a page and test it under content moderation.

Sample workflow

The author creates a page. The author saves this content as a Draft.

Author saves new content page

The editor publishes this content page. That is, the editor changes the moderation state of the content from Draft to Published.

Editor publishes new content page

The content page is now published. Anyone with permission to view published content will be able to view the page.

The author edits the content page and saves the new edit as a Draft.

Author edits published content page

The author can view the latest version of the content page in the Latest version tab. The latest version of the content page is a draft and is not publicly viewable.

Author views latest version

At this time, the author, and anyone else with permission to view published content, can, of course, continue to view the published version of the content page.

Author views published version of content page
 

The editor can publish the draft from the block in the latest version tab. That is, the editor can change the moderation state from Draft to Published.
 

Editor changes state to published

The editor can also publish the draft in the node edit form.

Editor changes moderation state in node form

Now the author, and anyone else with permission to view published content, can view the edited content page.

Note the Latest version tab has, rightly, gone away. Nicely done.

Author views edited content page

The above describes a simple publishing workflow. This is only one example. There are all kinds of possibilities being delivered with the Content Moderation module. Look more deeply into States and Transitions. Consider multiple workflows for complex publishing environments. This module will really move things forward for our team and hopefully for Drupal itself.