Workflows for Drupal 8: Content, Revisions and Moderation

Workflows for Drupal 8: Content, Revisions and Moderation

Editor's note: This is the fourth installment of a 2018 update to our "The Ultimate Guide to Drupal 8" blog series, fresh off the presses for Drupal 8.6.

Some of Drupal 8's most exciting new features for content authors are around workflow and moderation.

Webinar: Why, When, How to Decouple

Dries Buytaert shares how Drupal has an advantage over competitors, and discusses how to decouple.

WATCH NOW

Content Revisions

Content types and custom block types are configured by default to require revisions. This allows tracking of who changed what and when, and also provides a log message associated with any edits, to inform other content authors about why a change was made.

The system keeps a log of all revisions in the system, and allows reverting to prior revisions if the need arises.

There is ongoing work to enable revisions on other parts of Drupal 8 as well, such as menu links and comments.

Content revisions in Drupal 8

Workflows

Get updates

Receive the best content about the future of marketing, industry shifts, and other thought leadership.

Content production and management has a lifecycle. Blog posts like this one begin as outlines that become drafts, then other people may review them, edit them and when they look good, the posts are published.

Even after publishing, there may be workflows for translations and archiving the content later. But Drupal is used for a lot more complex scenarios, let's say a shop's inventory management where products are backordered, arrive in inventory and then sold. Or users that begin as newcomers and gain higher status on the system later.

The workflows module allows defining multiple workflows that define their states and the transitions allowed between them. In the above examples, blog posts could have a publishing workflow, inventory items could have a warehouse workflow and user profiles could have a user stature workflow. Each of which has its own states (backordered, in stock, sold for an inventory workflow for example) and transitions (only products in stock can be moved to sold).

However, all of these examples are theoretical as the workflows module merely provides a framework to manage them and the behaviors for them should be provided by other modules. That is where content moderation comes in.

Content Moderation

By default, content in Drupal has two states: published (visible on the site) or unpublished (visible only to the author and site admins). However, many sites have more complex publishing needs.

The content moderation module builds on top of the workflows module and Drupal 8's ability to create content revisions that are not live yet but newer than the last live version. It ships with a default "editorial workflow" with "draft," "published," and "archived" states, which are useful for state tracking in simple publishing scenarios.

Drupal publishing workflow

This workflow can either be modified and extended for more complex use cases, or another publishing workflow can be created if you plan to apply a simpler workflow to your blog posts and a more complex workflow for your press releases. Your workflow for press releases could look like: new => draft => media / asset review => legal team sign-off => published.

You can also create multiple editorial roles, and restrict users' ability to move content to and from these workflow states (for example, only admins can use the restore and restore to draft transitions ).

Drupal content moderation

User interface elements are also provided on content items that are configured for the workflow allowing content editors to run transitions. The content moderation module ties the states back to publishing statuses, so drafts and archived content goes unpublished while content in other states are published. Further added states can also define their publishing status and whether content in that state becomes the default revision.

An overview for managing unpublished content that's awaiting moderation is also available.

Drupal 8 content moderation

Content Staging (Experimental)

Although content moderation works great for staging single pieces of content, sites often have a need of staging multiple pieces of content at once (for example, an article with callout blocks and video assets), and previewing the changes that will be made to content listings or landing pages.

Fortunately, the robust workspaces module provides full content staging capabilities for these scenarios. You can define multiple workspaces (such as "staging" and "live") which are copies of your site, and create content (or modifications to existing content) that is visible only within that workspace. Then, once the changes have been verified, you can "deploy" the content to another workspace at the click of a button.

This functionality is particularly useful for events where there are multiple possible outcomes (such as elections or sporting events), that require vastly different hero images, featured articles, advertisements, etc., depending on the conclusion. Workspaces allow you to build out the entire content for either scenario ahead of time and then publish the lot at once, once the winner is announced.

Drupal 8 content staging

That's a Wrap

Join us for our next installment, when we'll be talking all about Drupal 8's multilingual capabilities.


Special thanks to Gábor Hojtsy for co-authoring this section.

webchick

Angela Byron

Director, Community Development Acquia, Inc.