How to programmatically use Workflow module

Created on 19 August 2014, about 11 years ago
Updated 5 March 2024, over 1 year ago

Sorry if this has been explained else where, I might have missed it. And I have been reading a lot.
I'm using workflow 7.2.x-dev with workflow_field module to add a workflow to an entity.

I am a bit confused at the moment on the best way to programmatically change a state with the new (for me anyway) OOP way of dealing with workflow.

1. Can somebody please give me an easy example to programmatically change a workflow state. I am also especially interested setting up a new scheduled transition. Basically:
if user change state from A->B, I want to automatically set up a scheduled change to change to C at time x

I know there is Rules module, but I would prefer to use code, as there are some other things I want to do.

2. I take it, to detect a state change, the best is still to use hook_workflow with $op transition_pre? Or is there a better way?

πŸ“Œ Task
Status

Active

Version

1.0

Component

Documentation

Created by

πŸ‡ΏπŸ‡¦South Africa Max_Headroom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024