Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'd like to programmatically alter the target state of a transition in certain situations. I thought I might be able to do it with hook_workflow, op == transition pre, but the transition object isn't passed by reference.
If I veto the current transition and create a new one from within hook_workflow, I have to do something to prevent an infinite loop. I'm doing this whenever the current state is X.
Note that when I need to change the target state, it's always back to the previous state. Is it possible to use workflow_revert programmatically from within hook_workflow?
Thank you!
Comments
Comment #2
johnvYou have numerous options. Please check workflow.api.php from the dev version.