Workflows
Keel runs Pimcore workflows. There is nothing to switch on: a workflow under pimcore: workflows: shows up in Keel
for the classes it supports. Editors use it as described in Workflow steps.
Keel adds no workflow logic of its own. It asks Pimcore's workflow which steps are possible, and runs them through
Pimcore\Workflow\Manager::applyWithAdditionalData() – the same call as Studio's Actions. Guards, notes, events,
notifications and changePublishedState therefore behave as in Pimcore.
What Keel reads from the workflow
| Workflow config | In Keel |
|---|---|
places.<place>.label, title, color | The pill: name, tooltip and colour. Labels go through Pimcore's admin translations. Without color, Keel picks one by meaning (draft, review, approved, rejected). |
places.<place>.permissions | Applied by Pimcore itself: Keel's Save, Publish and Delete follow isAllowed(). |
transitions.<name>.guard | Decides whether a step is offered. The server checks again when it runs. |
options.label | The step's name |
options.notes.commentEnabled, commentRequired | The note box; required means the step cannot be sent without it |
options.notes.commentGetterFn, commentSetterFn | Prefills the note; the setter runs in Pimcore |
options.notes.type, title | The note Pimcore writes. Keel's Activity tab shows notes of these types. |
options.notes.additionalFields | Asked for in the step's form: input, textarea, numeric, select, checkbox, date, datetime |
options.changePublishedState | Shown in the panel (Publishes the item); applied by Pimcore |
options.unsavedChangesBehaviour | save: saves first. warn (default): offers Save my changes first, ticked. ignore: runs on the saved item, unsaved changes stay in the form. |
What Keel leaves to Studio is listed in Limits.
The place as the list's status
When the marking store keeps the place in a select field of the class (single_state), that field becomes the
list's status field, unless the admin or keel.yaml chose another.
The list then gets the place pills and filter chips, with the workflow's labels and colours.
- The select should list the places as its options. Places it does not list are added.
- Customize → Statuses can still change a colour or which places count as closed.
- Add the field to the list's columns (Customize, or each person's Columns) to show the pill in the rows. It is one of the default columns unless the admin saved a column choice for that list.
- With other stores (
state_table,multiple_stateon a multiselect) the editor's pill and steps work, but the list has no place column or filter.
Existing items
An item with an empty marking field is in the workflow's initial place: the editor shows that place and its steps. The list reads the field, so it shows such items as No status until their first step.
When you add a workflow to a class that already has items, fill the field once. For a big class, set it in the
database (object_store_<class id> and object_query_<class id>) rather than saving each item, then clear Pimcore's
cache.
An example
A release workflow on a Tour class, with the place in the select field releaseState. Only admins and the Pimcore role
tour_approver may approve, and rejecting needs a reason:
pimcore:
workflows:
product_release:
label: 'Tour release'
type: 'state_machine'
supports:
- 'Pimcore\Model\DataObject\Tour'
initial_markings: [draft]
marking_store:
type: single_state
arguments: [releaseState]
places:
draft: { label: 'Draft', color: '#64748b' }
in_review: { label: 'In review', color: '#d97706' }
approved: { label: 'Approved', color: '#059669' }
rejected: { label: 'Rejected', color: '#e11d48' }
transitions:
submit_for_review:
from: [draft, rejected]
to: [in_review]
options:
label: 'Submit for review'
notes: { commentEnabled: true }
approve:
from: [in_review]
to: [approved]
guard: "is_fully_authenticated() and ('ROLE_PIMCORE_ADMIN' in role_names or 'ROLE_TOUR_APPROVER' in role_names)"
options:
label: 'Approve'
reject:
from: [in_review]
to: [rejected]
guard: "is_fully_authenticated() and ('ROLE_PIMCORE_ADMIN' in role_names or 'ROLE_TOUR_APPROVER' in role_names)"
options:
label: 'Reject'
notes: { commentEnabled: true, commentRequired: true }
A Pimcore role appears in guards as ROLE_ plus its name in capitals: the role tour_approver is ROLE_TOUR_APPROVER.
After changing the workflow, clear the cache (bin/console cache:clear).
Rights
- To run a step: the right to view the item, and the workflow's own check (place and guard), as in Studio. The save right is not needed. To make a step depend on it, use a guard.