Change record status: 
Project: 
Introduced in branch: 
8.4.x
Introduced in version: 
8.4.0
Description: 

Previously settings for states were stored in both the Workflow config entity and the schema of the @WorkflowType plugin associated with a Workflow config entity.

Config schema impact

Old schema:
id: editorial
label: 'Editorial workflow'
states:
  archived:
    label: Archived
    weight: 5
type_settings:
  states:
    archived:
      published: false
      default_revision: true
New schema:
id: editorial
label: 'Editorial workflow'
type_settings:
  states:
    archived:
      label: Archived
      weight: 5
      published: false
      default_revision: true
Old way to add a state:
$workflow->addState('test_state', 'Test state');
New way:
$workflow->getTypePlugin()->addState('test_state', 'Test state');

Impact on Workflow(Interface) (entity type)

The full list of methods that have moved from WorkflowInterface to WorkflowTypeInterface is (with no BC layer):

  • addState()
  • hasState()
  • getStates()
  • getState()
  • setStateLabel()
  • setStateWeight()
  • deleteState()
  • getInitialState()
  • addTransition()
  • getTransition()
  • hasTransition()
  • getTransitions()
  • getTransitionsForState()
  • getTransitionFromStateToState()
  • hasTransitionFromStateToState()
  • setTransitionLabel()
  • setTransitionWeight()
  • setTransitionFromStates()
  • deleteTransition()

Impact on WorkflowType(Interface) (plugin type)

To accommodate this schema, the plugin forms are now defined in individual form classes referenced in the @WorkflowType annotation. These forms replace the methods that were previously implemented directly on the plugin type. Previously, it was impossible to influence the initial states & transitions of a workflow, but that's no longer a problem since each @WorkflowType plugin now controls schema + storage, so now plugins can just implement ConfigurablePluginInterface::defaultConfiguration().

Therefore the following methods have been removed from WorkflowTypeInterface:

  • initializeWorkflow()
  • buildStateConfigurationForm()
  • buildTransitionConfigurationForm()

(Validate and submit handlers had to be set manually with advanced Form API constructs.)

What's added: WorkflowTypeInterface now extends PluginWithFormsInterface, which is what makes it possible to reference form classes from the @WorkflowType annotation.

The workflows UI currently makes use of three forms: configure, state and transition. The new form classes should implement PluginFormInterface and may extend WorkflowTypeConfigureFormBase,
WorkflowTypeStateFormBase or WorkflowTypeTransitionFormBase respectively.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done