Closed (fixed)
Project:
Workflow
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Feb 2017 at 22:31 UTC
Updated:
21 Dec 2018 at 02:08 UTC
Jump to comment: Most recent
Comments
Comment #2
johnvThe comments of the deprecated function should point to the new version.
In any case, you will find ample documentation in workflow.api.php file.
Comment #3
hosef commentedThe deprecation note on
workflow_transition()points toWorkflowDefaultWidget::submit().WorkflowDefaultWidget::submit()assumes that we are submitting the workflow_transition_form and passing in the form and form_state arrays. I want to change the workflow state of a node without submitting the workflow_transition_form, which was possible in the old version of the module by callingworkflow_transition($node, $new_sid);Workflow.api.php describes how to respond to a transition that already happened and how to modify the workflow_transition_form, but it does not describe how to trigger a transition in the first place.
Comment #4
hosef commentedAfter digging through the code some more, I found that I can use the WorkflowTransition entity class to force a state change on a node by doing something like:
If you are using the workflow_node module instead of the workflow field, just set $field_name to an empty string.
Comment #5
johnvIndeed.
Comment #7
alan d. commentedWhen using fields, even easier: Replace field_kpi_workflow with the field name.