## Workflow in Lightning

Lightning's Workflow component is based on Workbench Moderation. It allows you to put content into various moderation states, like Draft, Archived, Published, and so forth. You can define as many moderation states as you like. A moderation state is either published or unpublished, which determines whether or not its accessible to your sites visitors.

The moderation state of any given bit of content can be changed by means of state transitions, which allow you to define what changes are allowed. For instance, you might allow content editors to transition a piece of content from the Draft state to Needs Review, but only allow administrators to transition that same content from Needs Review to Published. Users can only make use of transitions to which they have access. Access is controlled by permissions.

Lightning ships with two content types -- Basic Page and Landing Page. Both have moderation enabled. There are four states: Draft, Needs Review, Published, and Archived. New content is created the draft state by default, but (depending on your permissions, of course) you can change it to a different state when you save it.

Enabling moderation for a content type means that every time you save changes to a piece of content, a new revision of that content is created. A revision is a snapshot of the content as it was at a certain point of time. It's important to note that a new revision is created every time you save a piece of content. Even if you didn't change anything. Even if you only changed basic things like the title or moderation state. Lightning maintains a complete history of every change ever made to any piece of content, plus useful information such as who changed what, when.

Confusingly, Drupal refers to the most recently created revision as the "current revision". That's because it assumes that your most recent revision is published. In Lightning, by contrast, the most recent revision might not be the published one. It is entirely possible for you have created a piece of content, gone through several revisions, published it, then created a new revision in the draft state. In this situation, the new draft revision is NOT published — only the most recent published revision is visible to your site's visitors. Newer, unpublished revisions are referred to as forward revisions.

When working on moderated content, you will see that the Save button allows you to transition the content's moderation state. Out of the box in Lightning, the button will read "Save and Create New Draft", but that (as well as the other options the button gives you) may vary depending on the permissions you have. After saving the content, you'll be able to continue iterating it and making changes until you (or someone who the requisite permissions) transitions it to a published state. When there is more than one revision, you will see a Revisions tab when viewing the content (assuming you have the permissions to see it), which is a very basic overview of the content's revision history.

If you visit a piece of content in a published state, you can click the New Draft tab to create a forward revision. You will be able to edit and iterate over this new revision like you normally would, without affecting what your site visitors see. Only when you publish the draft will it be accessible to visitors.