<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=652504974959061&amp;ev=PageView&amp;noscript=1">

Drupal for Business

At Duo, we build connections.

Understanding the Workflow Initiative in Drupal 8

Rich LawsonWritten by Rich Lawson
Jun 27, 2016 9:00:00 AM

As Dries shared in this year’s Driesnote at DrupalCon, he has suggested a variety of different initiatives to help improve Drupal 8’s core offerings. One of the initiatives Dries shared was the Workflow Initiative, which is already underway. The history of this initiative is explained in the post Dries wrote in April, Improving Drupal’s Content Workflow. In this post, I’ll discuss the functionality on the roadmap of the Workflow Initiative over the next few years and what you can expect from the roadmap. 

Drupal 8 Workflow Initiative

As stated on the Workflow Initiative page, the goal is to bring major improvements to Drupal’s content workflow, preview, and staging capabilities. This will be done by extending and improving parts of the Entity API in core. The initiative also draws from a number of Drupal 8 contributed modules.

One exciting improvement for Drupal 8 is that there are now major releases that introduce new functionality to the platform without having to wait for a completely new version of Drupal (i.e., Drupal 9). Drupal 8.1 was already released in April, which includes enhancements to the CKEditor WYSIWYG editor, new APIs, and new experimental modules like BigPipe.

This means that enhancements to workflows in Drupal 8 can be implemented over time, so the current roadmap targets new workflow enhancements for Drupal 8.2 through 8.5.

The following features have been prioritized as must-haves:

Feature

Target Drupal Core Release

Revision history for all content entities in core

8.2

Moderation API (with a minimum viable product)

8.3

Trash bin functionality

8.3

Workspace API (without a UI)

8.4


Revision history for all content entities in core

The main goal is for all content entities (except the user entity) to be revisionable using the Revision API for the Drupal 8.2 release. This means that editors would be able to consistently track revisions for all content. Once supported, revisions could be enabled by default so that content changes are tracked automatically, without any additional configuration from editors.

From a technical perspective, changes are necessary to facilitate this. Content entities’ baseFieldDefinition should inherit from parents, and RevisionLogInterface should be implemented. As an example, two significant changes have been made to the block content entity. BlockContent now has a  revision_user and revision_created field, and BlockContentInterface implements RevisionLogInterface.

Moderation API

Targeting the Drupal 8.3 release, this feature would allow for the moderation of a publishing state on individual content entities. This would be handled through an experimental module, similar to the way BigPipe functionality was added in Drupal 8.1. There are still a number of issues remaining before the Content Moderation module will be complete.

Trash Bin functionality

This trash bin functionality will also be handled through an experimental module intended for release in Drupal 8.3. Currently blocked by incomplete work on the Revisions API, the addition of this functionality also relies on the deprecation of the delete method in the Entity API in favor of two new methods: archive and purge.

The new archive method would not delete an entity. Instead, it would create a new revision for an entity and flag it as being archived. The purge method would handle deleting the entity from the database. Two new hooks (hook_entity_archive() and hook_entity_delete()) would also be added to Drupal’s Entity API.

After these changes have been implemented, there is a Trash module available in contrib that can be leveraged to use the new methods to allow for the ability to restore content or permanently delete it.

Workspace API

The goal of this feature is to leverage work already done in contrib with the Workspace module to implement a relatively simple API in Drupal 8.4. A workspace is essentially a container of content within Drupal. Workspaces will be important for full-site previews, and current contrib modules implementations also suggest that workspaces will be important for deploying content across sites/environments.

The goal at this stage is not to implement the more extensive API that has been outlined for future phases, but instead to define the workspace entity, add a reference field for all content entity types, and extend storage handlers to work with workspaces. At this point, there will be no UI or changes to core functionality.

The Future

Once the must-have functionality described above is in place, the plans for the Workflow Initiative dive into some really exciting functionality. Full-site previews would allow editors to see exactly what the site would look like, as defined within a particular workspace. Conflict management would not only provide a way to see differences in content across revisions, but also ways of resolving the differences. There are also some initial plans for cross-site content staging, allowing content to easily be created in one environment or site and then deployed to another. Finally, this functionality also provides a foundation for adding autosaving of content as it is created to Drupal.

Learn more about other initiatives planned for Drupal 8 in this blog post: The Future of Drupal: Our Thoughts on the Driesnote from DrupalCon 2016.

Topics: Development

Popular Posts