Configure Workflow vs State Machine transitions
developIn a multi-state workflow, you can define transitions based on whether a subject must be in exactly multiple places or either of multiple places.
- Exactly multiple places: To require a subject to be in multiple places simultaneously (e.g., both
content_approvedANDlegal_approved), nest the array of places inside another array in thefromkey:['from' => [['place1', 'place2']]]. - Either of multiple places: To allow a transition from any one of several places (e.g.,
content_approvedORlegal_approved), provide a flat array in thefromkey:['from' => ['place1', 'place2']].
<?php
// Example 1: Exactly two places transition to one (Nested array)
'transitions' => [
'publish' => [
'from' => [
['content_review', 'legal_review']
],
'to' => 'published'
],
],
// Example 2: Either of two places transition to one (Flat array)
'transitions' => [
'publish' => [
'from' => [
'content_review',
'legal_review'
],
'to' => 'published'
],
]