Concentrate getting the workflow instance ID to one method.

Created on 11 February 2022, almost 3 years ago
Updated 29 March 2024, 8 months ago

Problem/Motivation

Our client needs to have a multistep form for a custom entity. The idea is that users will have their own single profile to modify. Looks like the forms_steps module does a lot of work out of the box. But since users won't be able to create more than one profile we need to remove the workflow_id parameter from the URL and get it from another location. Seems it's not a big problem thanks to a good module architecture. The only issue we faced right now is getting the workflow instance ID. In some pieces of code, we are getting it directly from the request on other ones using the FormsStepsHelper::getWorkflowInstanceIdFromRoute() method. Getting workflow_id directly from the request means that we need to duplicate a lot of code in order to change one line, e.g. WorkflowManager::entityInsert and WorkflowManager::entityPreSave.

Proposed resolution

Move getting of the instance_id to the FormsStepsHelper service. This approach will allow other modules to decorate it, in case they want to override the getWorkflowInstanceIdFromRoute method.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇺🇦Ukraine id.aleks

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