Default revisions, forward revisions, and past revisions

Submitted by timmillwood on Wed, 15/02/2017 - 10:15

Drupal 8 has two revisionable entity types, Node and Block Content. When working with revisions it's key to understand the different states a revision can have.

If you have a node with the ID 1 you can load it with Node::load(1);, this will load the default revision. You may have 200 revisions of node 1, but the default revision is the one which is loaded by default.

Currently forward revisions are revisions with a higher revision ID than the default revision, and past revisions are revisions with a lower revision ID than the default revision.

Workflow Initiative Needs Review

Submitted by timmillwood on Thu, 08/12/2016 - 10:49

We have been extremely hard at work this year with the Workflow Initiative bringing some quite big underlying changes to the Entity API and some great advances in core such as the Content Moderation module. There are now around 8 weeks until feature freeze for 8.3.x and there’s still a number of key things we want to get in. Please take a look at our kanban board and see if there’s anything you’d like to take a look at even if it’s just a quick review, a little feedback, or a +1.

At the time of writing this post there are 8 Workflow Initiative issues in Needs Review:
Which core entities get revisions?
We are looking at making more content entities in core revisionable, this will roll out gradually, but which ones should we make revisionable?

Add a content entity form which allows to set revisions
This is mainly an effort by the Media Initiative, but affects the Workflow Initiative too. The idea is to have a generic entity form for revisionable entities.

Add a publishing status field to BlockContent
Shock horror! Block content entities are currently not able to be unpublished. We need to fix this! This will be a pattern for making other things able to be unpublished too.

Upgrade path between revisionable / non-revisionable entities
This patch has had so many iterations but the current one is looking pretty awesome. It will give ups an upgrade path for entity types such as taxonomy terms and menu links to have revisions.

Introduce sorted set key value store
Before we introduce Workspaces in core we want to store a sequence of entity updates, a sorted set key value store will allow us to do this.

Store revision id in originalRevisionId property to use after revision id is updated
There are a number of bugs in core which require us to know what the revision id of an entity object used to be. This issue solves this by adding a simple property.

Introduce a EditorialContentEntityBase class for revisionable and publishable entity types
When we make more entity types revisionable and publishable it’d be great if they all extended the same base class. This issues does this for Nodes, we will then be able to roll it out to Block content once publishable, and other entities once revisionable.

WI: Content Moderation module roadmap
Content moderation is currently in core as an alpha experimental module. How can we get this to beta then stable?

Core development is frickin’ hard

Submitted by timmillwood on Tue, 06/09/2016 - 14:25

For the last 18 months I have been working full-time on Drupal workflow solutions, first with the Deploy suite of contrib modules, and now with the core Workflow Initiative.

It turns out core is a lot harder than contrib. Everything we have mapped out in the plan for the Workflow Initiative is already done, and working, in the contrib modules. So getting it all in core should be easy, right. Just port over the code from the modules into core APIs or core modules and it’s done. Well… no.

Everything in core needs to be generic, it needs to work for everyone. In contrib you can choose not to use module X if it’s not compatible with module Y, or if it doesn’t work with your use case, in core there is less of that luxury.

Also in core everything has to be done “properly”. We can’t just get a solution that works well enough and run with it, we need to be sure it is the best (or least worse) solution.

Some examples of the issues we are facing so far is with the Upgrade path between revisionable / non-revisionable entities issue. In contrib we use the migrate module to migrate all content out, make entity types revisionable then migrate everything back. For core this is not stable enough so we need a custom set of update hooks. Then Add StatusItem field type to store archived state in contrib we just add a new base field to all entity types to store the archived state. In core there are performance concerns with a new field and new conditions.

Thankfully there are so many people working and thinking about things that will help some of these areas, and as we continue to develop core we should be able to make things easier.

Content Moderation and Workspace module

Submitted by timmillwood on Thu, 25/08/2016 - 09:23

Drupal 8.2.0 will see a bunch of new experimental modules. Once of these is Content Moderation. This is a port of the Drupal 8 release of Workbench Moderation, with a number of updates to make it suitable for core.

Work is currently underway to get Content Moderation working for Workspaces. Workspaces, defined by the Workspace module and it’s dependency Multiversion, are a way of creating different versions of your site’s content and getting the elusive “full site preview” functionality. With Content Moderation you are able to moderate a whole Workspace. Then once published all content will be deployed to the live workspace.

The screencast below shows adding some content on the Stage Workspace and confirming the content doesn’t exist on the Live Workspace. Then publishing the Stage Workspace results in the content being on both Workspaces.

Drupal Deploy demos

Submitted by timmillwood on Fri, 06/05/2016 - 08:32

Single site content staging with Deploy

This demo shows creating content on a stage workspace then deploying it to live. Once deployed an edit is made on the live workspace and an update is done on stage to pull from live.

Cross site content staging with Deploy

Now with RELAXed Web Services installed cross-site deployments can be done. First replicator users are setup with the permissions to replicate content. These users are added to the Relaxed settings on Drupal 1. A remote is added to Drupal 1 for Drupal 2. The live workspace is updated to set the upstream workspace to Live on Drupal 2. Content is created on Drupal 1 and deployed to Drupal 2. A change is then made on Drupal 2, and Drupal 1 is updated to pull the changes from Drupal 2.

DrupalCon New Orleans 2016 - Proposed sessions

Submitted by timmillwood on Mon, 29/02/2016 - 10:53

This year I have proposed three sessions for the North American DrupalCon based on the topics I have been working on for the last 9 months.

Please take a look, ask questions, make comments, and share.

Building sites with Composer
If you have been keeping up to date with by blog you will notice I have been working a lot with Drupal and Composer. In this session I will share this knowledge and look from a site builders perspective.

Managing and staging your content
In Barcelona and Mumbai, Dick Olsson and I, presented on content management and content staging solutions. We have been continuing to work on improving these solutions and wish to give an updated session in New Orleans.

Drupal is a CMS, so how can we better manage content?
This session will discuss many of the same topic as the earlier session “Managing and staging your content” however from a much more technical point of view, and with the goal of, how do we get this into Drupal core. Drupal 8 now has configuration management, it’s time we also focussed on content management.