2019-02-13

Drupal workspaces prototype

GIF image courtesy of Dries Buytaert is a quick video of the Workspaces module in action

Introducing Drupal Workspaces

Workspaces is an awesome new core (built-in) module that ships with Drupal 8.6 core and higher. Workspaces provides an Agile-like workflow for your content creation process that allows site editors to prepare and preview a complete set of related content before making it available to the public. For example, you might have a new event coming up that includes the event announcement, a preview webinar, and a form to request more information and tickets. With Workspaces, you can review and publish the entire set of related content with a single click of the "Easy Button". 

Workspaces allows for the creation of multiple environments (e.g. staging, events, and live), and movement of content between the environments. Think of each environment as a parallel group of content. Editors and other groups (e.g. Legal) can edit content in any environment. There's no limit to the number of environments you can create. Until content has been deployed from a given environment, even if published in one environment, it will remain unpublished in all other environments. Taking our event example a bit further, you might add a second event managed by a different team to another environment. You could then deploy each event content after it was finalized. Changes in one environment have no affect on the others. 

The Workspaces module eliminates the need to have a separate site just to stage content, or staging content on a production site with some convoluted workflow. Once everything in a given environment is ready, use the magic Deploy to Live button to make all the changes visible. If further updates are needed later, use the same process again to make those changes live. 

You will be able to test-drive this feature on this Drupal 8 Demo site very soon. 

Workspaces Compared to Workflows: the Difference Between the two Similar Drupal 8 Core Modules

Here we discuss the Drupal 8 core Workflows module, so it's very important to know the difference between that and the Workspaces module. 

Not only do the two Drupal 8 core modules sound similar, they actually provide similar functionality. In fact, we wanted to launch this Drupal 8 demo site with both modules enabled and with click-through tutorials for each, but they (at the time of this writing) are not compatible. 

In brief, the Workflows module, when used with the Content Moderation module, provide site architects the ability to create simple to complex content approval workflows. In short, the Workflows module allows easy implementation of state machine logic for the process of getting a page from draft to published.

Essentially, different roles may have different permissions to transition a given page from one state to another. Workflows provides simple to complex governance workflows, and are ideally suited to medium to large entities that require a few to multiple touch points before publishing or editing a page.

For example, a student at a university could create an event, the department could approve the event contents, the facilities could assign a room number, and perhaps some sort of final approval could then be applied to get the event published and added to a calendar. 

So what's the difference between Workspaces and Workflows?

  1. Workflows can be applied to blocks, media, and page types, but they only can be applied to one given Drupal entity at a time. 
  2. Workspaces provides a bulk moderation process currently limited to pages (although it seems reasonable to extend this to menu items, blocks, tags, etc.). The group of content is then reviewed and edited in one "environment", and deployed to another. 

We strongly believe the modules should work together, but there are a couple of issues that the Drupal community must hash out first before this becomes a reality. We hope this is resolved by Drupal 8.7 or 8.8 at the latest (meaning this coming May or December, 2019). 

An Example of the Workspaces module in Drupal 8 in Action

After enabling the Workspaces module, anyone with permissions will see a nice green Live button in the upper-right of the administration menu. Upon clicking the button, a stylish black Workspaces user interface appears above the administration menu (see below). Within the UI, we are presented with one or more environments to switch to on the left, while the current environment is displayed on the right, along with a link to "Manage workspaces".

Webdrips Drupal 8 Demo Workspaces Module After Activation
Webdrips' Drupal 8 Demo Site after Activating the Workspaces Module

Upon clicking the Stage icon on the left, we're prompted to active that workspace. The active environment is always the one we see on the right, with or without the Workspaces UI display. 

Webdrips Drupal 8 Demo site Workspaces module activate staging confirmation
Drupal 8 Demo Site Activating a new Workspace Environment

Once you switch to a new workspace, you are free to create content that is "assigned" to that workspace. Even if you set a given page to Published for one workspace, it will remain unpublished in all other environments until the content is deployed to the Live workspace. 

Important note: you will not be able to create certain content (e.g. media, menu items, etc.) or perform certain actions (e.g. assigning a block to a content region) in any workspace other than live. We believe this will be less limited in the future as the module gets fleshed out over time. 

Okay so we'll create a new page and a new custom block in the stage workspace. If we visit the site in another browser while logged out, we note it's not possible to access any content in the stage workspace. 

Once satisfied your new content set is ready for public consumption, click the Deploy content button in the Workspaces UI. 

We can’t see any articles when we visit our site’s main page in the Incognito window, because they are not yet deployed to “Live.” Let’s click “Deploy to Live,” and we will see a summary of the items to be deployed.

Webdrips Drupal 8 Demo site deploy stage workspace content to live confirmation
Drupal 8 Demo Site Deployment of items from Stage Workspace to Live

Upon clicking the Deploy X items to Live button, we'll receive a confirmation message, and, if the content was published in the Stage Workspace, it will also be published on the Live one. 

We can now switch to the Live workspace to confirm the content is published and visible to site visitors. Now is the time to assign the new content to menus, place your blocks, and so on.

Conclusion

As you can probably imagine by now, the Drupal Workspaces module that comes with Drupal 8.6 and later provides a nice way to manage a group of content on a live site without making it visible to visitors until it's ready for public consumption. If you'd like to get a demonstration of this content live, please use the I'm Ready to Talk button in the header, or the form below to send us a note.