Are you building a Drupal 8 website that has some complicated revision and workflow rules? Or maybe you’re struggling to write migration plugins that should atone for various content revisions? Then you must be asking yourself: “What’s the most efficient way to work with Drupal 8 content revisions?”
What are the best Drupal modules to use to incorporate revisions into your custom workflow? To enhance the Drupal versioning capabilities that Drupal provides you with out of the box?
I took a look into my own toolbox, then did a bit of research, and I came up with this selection of 6 modules to use when working with content revisions in Drupal:
1. But First: What Are Content Revisions?
“Drupal allows you to revise your content and keep track of both the original version and all the revisions you make.” (source: Dummies.com)
Before we delve into the modules that you can add to extend the content revisions capabilities that you get by default, let’s focus, briefly on the concept itself.
Here’s the shortest definition on content versioning that you’ll find:
Keeping track of all changes made to a text.
Take a blog post, for instance. You can configure Drupal to save a copy of the current version of the post along with a copy of its edited version.
And here’s how you create content revision in Drupal 8:
- You log into your admin panel
- Click the “Content” tab
- Select the article or the basic page you want to update
- Click “Edit”
- Make a change to that piece of content
- Scroll down to “Revision Information”
- Give it a click
- Select “Create New Revision” and write some explanations regarding the update that you’ve just made right in the “Revision Log Message” box that you have there
- Click “Save”
Now you’ll see a new “Revisions” tab, that you can use from now on to check all the saved revisions of that piece of content.
Tip: To retrieve the original version of the article/basic page, just click “Revert” in the "Revisions” tab
2. Drupal 8 Content Revisions: How Many Types Are There?
3, actually: default revisions, pending revisions, and past revisions.
2.1. Default revisions
Drupal’s set to turn the newest revision into the default one (or the “published” one).
That unless something intervenes to change this default process. For instance, the Content Moderation module can use a set of criteria according to which the newly updated content should be saved as default/published or as a pending reversion.
2.2. Pending revisions
Or “draft” or “forward” revisions.
It’s that revision that a content editor in your team makes, but which shouldn’t replace the currently published revision. For now, it’s just pending in the admin panel.
2.3. Past revisions
Each time Drupal creates a new default revision, the previous one becomes a past revision.
In a nutshell:
- default revisions are currently live on your website; it's the content that your site visitors can see
- pending revisions in Drupal are no more than draft content and possible future states
- past revisions are old states of the content, that provide you with a record of all the changes applied to it over time
3. Content Revisions in Drupal: 3 Most Common Challenges
Before we delve into the list of modules that I’ve prepared, let me try and guess your current “struggles” with managing Drupal 8 content revisions:
- You need to edit live content while maintaining new drafts
- You need to enable/disable revisions for each content type
- You need to migrate content along with its “ecosystem” of revisions
Have I “guessed” it right?
4. The Multiversion Module
“Multiversion will convert all core content entities on your site to be revisionable.” (source: Drupal.org)
Think nodes, block content, taxonomy terms, comments…
Why do you need it?
Because Drupal’s default content versioning capabilities are limited to block content and nodes.
And not only that Multiversion makes all the content entities on your website revisionable, but it implements a CRAP (Create Read Archive Purge) workflow, as well. Meaning that once you delete a content entity, it gets automatically archived.
You can then revisit your archived content in Drupal, at any time, and remove those that you no longer need.
Furthermore, the module provides you with workspaces. You get a new instance of your website set up so that you can work on your content.
Word of caution: make sure you set up a database backup before you install/uninstall the Multiversion module. That is because it performs complex storage changes and critical data migrations between storages.
5. The Content Moderation Module
Part of Drupal Core since its 8.5.0 version, the Content Moderation module is the “pillar” of every custom editorial workflow that includes complex revision rules.
What it does — among many other things — is enable you to edit nodes and set up new content revisions to be approved.
“This module does what a lot of people know under staging. While you have a live version for all visitors, you can work on a new revision (or revisions). To set a newer revision live, you have to approve it in a workflow.” (source: Drupal.org)
Here’s how it works:
- once you enable the content_moderation
- the basic "Draft, Published, Archived" workflow gets created for you
Why would you use it?
- Because it enables a workflow to be attached to one of your entity types or bundle
- Because it makes it possible for revisionable content entities to go from one moderation state to another
- Because it allows you to include user roles into your custom workflow as well; you can grant review and/or approve permission to specific user roles only
In short, you’ll get a full history of all the revisions created, with dated records of the updates and the names of the users that performed them and of those that approved them.
“The live-version history gets updated what means, that the reviewer and approver (or any other state change) are added to the list (with date). So you always have a history about what revisions have been approved when and who did it.“ (source: Drupal.org)
6. The Workflow Moderation Module
Another module to consider for managing your Drupal 8 content revisions. What it does is streamline the whole process of configuring your create-moderate-publish workflow.
7. The Workflow Module
Word of caution: it’s easy to confuse “Workflow”, a contributed Drupal module, with “Workflows” (that we’ll be focusing on in a bit), a core module that provides you with an API and UI for your content workflows.
Why would you consider it?
- Because it allows you to define highly customizable workflows and assign them to specific content entities
- Because it allows you to define your workflows to change the moderation state of your page, comment, form or special block…
- Because its Workflow Access submodule enables you to assign view/edit/delete permissions to specific user roles and according to the specific states that those content types have (i.e. only a user with the role of a "blogger" can delete a piece of content in Drupal, and only if that content has the status "archived")
- Because it enables you to set up specific actions to be triggered when a content type transitions from one workflow state to another (i.e. an email to be sent to the admin when a blog post has been edited)
- Because it “spoils” you with a user-friendly UI for controlling user permissions and monitoring transitions
When would you use it?
When your workflow includes more than 3 user roles and moderation states.
With its “cluster” of submodules and powerful functionality, it’s best suited for complex workflows and content revisions in Drupal.
8. The Workflows Module
When would you use the Workflows add-ons to manage Drupal 8 content revisions?
For instance, when you start to edit the content of a web page and you need to leave the editing process pending for a while. So, you won’t publish it right away, but save it as a “draft”.
You can then go back and continue to edit it, as many times as needed, while your website visitors get to see the final version only when you publish it on your site.
What the Workflows module does is allow you to manage your content workflows with states and transitions.
Now, in order to see your currently available workflows, just:
- Access your admin panel
- Go to your Configuration > Workflows (/admin/config/workflow/workflows)
You’ll see there a list of your workflows, as well as a link for configuring a brand new one.
Note: The Workflows module depends on another module (i.e. Content Moderation) to implement a workflow type. In other words, you can’t use it alone to create your workflows.
Let’s say that you want to compare 2 different revisions of the same piece of content in Drupal. To analyze, in parallel, all the changes applied to them.
What do you do?
For yes, you’re able to see a record of all the revisions made to a piece of content right there, in your default Revisions tab. But Drupal doesn’t automatically compare them, as well.
You install the Diff contributed module to enhance Drupal’s content revisions functionality.
Then, you’ll be able to see precisely what has changed between two revisions of the same content. And not just the “bulk” of revisions created for that content.
And this is how you do it. How you manage Drupal 8 content revisions the… efficient way.
What other modules and tools would you have added to this list? How do you make content revisions in Drupal work seamlessly with the projects that you’re working on?