- Issue created by @mbabayan
- π³π±Netherlands johnv
Please check workflow.api.php.
When you enable workflow_devel module, each of the hooks in workflow.apiphp is called.
The $transition object contains multiple gettes and setters, as per the WorkflowTransitionInterface.
E.g., $transition->getTargetEntity() gives the main entity. $transition->getToSid() and getToState contain the new Stae and StateID. - π³π±Netherlands johnv
Or you can use the 'magic' functions:
- $value = $transition->{$field_name}->value;
- $value = $transition->{$field_name}->__get('foo');
- $transition->{$field_name} = $values[$field_name]; using form_state->values() - πΊπΈUnited States mbabayan
With apologies, I'm still stuck.
I understand how I can get to the transition object. I can also get the "To" State via $transition->getToState().
How do I get a value of the field defined on the workflow form from there? E.g. the field system name is "field_reassign_to".$transition->getToState()->get("field_reassign_to") does not return anything, even though the transition is performed with this field populated in the workflow form.
Thank you!
- π³π±Netherlands johnv
Your field is not in the state, but on the transition.
(Indeed, the naming of the added field 'Workflow State' may be confusing)So, try:
$field_name = 'field_reassign_to' $transition->{$field_name}->value; or $transition->get{$field_name}->value;
Thisis like any entity with fields added via field UI.
- Status changed to Fixed
11 months ago 2:34am 28 March 2024 Automatically closed - issue fixed for 2 weeks with no activity.