Problem/Motivation

In the (attached) predecessors of this issue , problems were addressed when a WorkflowTransition has an attached field like FileItem.
Actually, the problem seems to be with any widget that contains AJAX buttons, like 'Upload file', 'Add another', or 'Remove'.

In Workflow v2.1.8, the widget is rationalized to use 'official' Widget interface. On a Node form, the WorkflowTransition widget is now created by calling the 'WorkflowTransition' form (like happens on History tab or Workflow Block) and then wrapping it in a widget. This is possible since all attributes are added as WorkflowTransition::baseFieldDefinitions().

This works fine and removes a lot of duplicate code.

However, in some use cases, the ajax widget for attached fields are broken.

Steps to reproduce

- Create a workflow,
- add a File field to the Workflow
- Create a Node Type with Workflow State field of above Workflow
- Add a multivalue field e.g., Number or Text.
- (Other widget may give the same or other result, like IEF complex widget)
- Create/Edit a node of above Note Type
(Note: in the past, a problem only existed on 'Create' case. now, there is no difference)
- Test 1: Go to Workflow History view, add a file, or press 'Add' on a mulitvalue number, then add a file --> OK
- Test 2: Go to Node form, Add a file item to the WorkflowTransition - this works fine - the file is attached.
- Test 3: Go to Node form, Press Ajax 'Remove' or 'Add' button of Transition multivalue field, then add a file item - The file is not attached.
- Test 4: Go to Node form, Press Ajax 'Remove' or 'Add' button of Node multivalue field, then add a file item - The file is not attached.

Proposed resolution

Best guess is that the $form['#parents'] is set incorrectly in the WorkflowDefaultWidget::formElement().
It is also set in WorkflowTransitionForm::form().
Or: the $form_state is not passed correctly.

Remaining tasks

- Test simpler widget on WorkflowTranstion - The file widget is a complex widget - add test with Number multivalue field on WorkflowTransition
-

User interface changes

API changes

Data model changes

Comments

johnv created an issue. See original summary.

johnv’s picture

Issue summary: View changes
johnv’s picture

Issue summary: View changes
johnv’s picture

Version: 2.1.x-dev » 2.1.7
Status: Active » Closed (outdated)
Related issues: +#3552010: Manage Transition widget via Workflow 'Form Display' field settings

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.