Change record status: 

Published (View all published change records)


Drupal core

Introduced in branch


Introduced in version: 



#2849827: Move workflow "settings" setters and getters to WorkflowTypeInterface

#2893778: Remove deprecated Workflows methods

#2896722: Leverage PluginWithFormsInterface to encapsulate @WorkflowType schema and clean up state/transition form methods.

#2896725: Entirely remove the concept of WorkflowType(Interface|Base)::()initializeWorkflow


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 addedWorkflowTypeInterface 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.



You May Also Like

March 23, 2017
February 10, 2017
February 10, 2017
February 10, 2017
February 10, 2017
February 10, 2017
February 10, 2017
February 10, 2017
February 10, 2017
February 10, 2017