Feeds

Author

Upgrade Your Drupal Skills

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

See Advanced Courses NAH, I know Enough
Nov 16 2021
Nov 16

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
Jul 06 2021
Jul 06

Configuration management is one of the greatest features introduced in Drupal. It enables developers to easily push configuration changes from their development environment to staging, and then to production environments. There are cases where certain configurations need to be enabled only on certain environments. For example, modules like Devel, Kint, Views UI, are enabled only on development environments, but we do not have these modules enabled on production. 

Fortunately, the Configuration Split module provides a means to accomplish all of these goals by keeping configurations into a separate directory so we can import it in a certain environment. And the Drupal 8 Configuration Split module is also supported in Drupal 9! In this article, you will learn how to split configurations across different websites using this amazing module.

Split Configuration

Setup and using the Configuration Split module

Installing the Drupal Configuration split module is like installing any other contributed module. Use composer to install it since it automatically installs all of the necessary dependencies. Open the terminal, within the project and enter the command.

$ composer require drupal/config_split

Create the split configuration

Once installed and enabled, we can create one or more "splits" to keep our configuration file in a separate folder.

  • Go to Admin > Configuration > Development > Configuration Split Settings
  • Click Add Configuration Split Setting
  • Enter a Label.
  • In the folder field, enter the folder name relative to the Docroot.
../config/dev_split

Make sure the machine name of your split is the same as the folder name.

Dev Split
  • Choose the module you want to split. In our case – the Devel Module.
  • Add your development modules setting files to the config split. In this case, we are going to completely split the configuration for Devel.
Complete Split
  • Click Save.

Activate a Split

Once the split is created, it needs to be activated in order to carry out a split. The Configuration Split module does not provide a UI for this purpose, but instead we can modify our settings.php file to activate the split:

$config['config_split.config_split.dev_split']['status'] = TRUE;

Where, dev_split is the machine name of the split we created earlier.

Now, export your configuration using drush cex. You should see that your development modules have been exported to the dev_split directory.

Dev Split
  • For our Development split, we need to have it activated in the development environment, but not in production. To do so, we add the following to our settings.php on our development environment.
$config['config_split.config_split.development']['status'] = TRUE;
  • For the Production site we won't add this code in the settings file, or we can also disable it explicitly by using below code:
config['config_split.config_split.development']['status'] = FALSE;

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