[MGNLUI-5186] Provide 6 UI port for MultiValueChildNodeTransformer Created: 09/May/19  Updated: 22/Sep/21  Resolved: 25/Mar/21

Status: Closed
Project: Magnolia UI
Component/s: forms
Affects Version/s: 6.0, 6.2.6
Fix Version/s: 6.2.7

Type: Bug Priority: Neutral
Reporter: Marty Glaubitz Assignee: Adam Siska
Resolution: Done Votes: 0
Labels: composite, cs-bk, forms, jcr
Remaining Estimate: Not Specified
Time Spent: 2h 13m
Original Estimate: Not Specified

Attachments: Java Source File RealNewItemsJcrContentConnector.java    
Issue Links:
causality
documentation
to be documented by MGNLUI-6635 DOC: Add 6 UI configuration for 5 UI ... Closed
duplicate
is duplicated by MGNLUI-6305 Provide 6 UI port for MultiValueChild... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
[X]* Deprecation of MultiValueChildNodeTransformer points to a replacemet
[X]* supported by compatibility converters
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: UI framework implementation
Sprint: UI FW 24
Story Points: 5

 Description   

Original ticket description

Fields which use Nodes to store values will mutate Parent when creating a new child.

When creating a content app where you can nest nodes, you might run into following issue.

Given an item type whose form contains following multiValue Field:

- name: regions
  fieldType: multiValue
  label: Rehions
  transformerClass: info.magnolia.ui.form.field.transformer.multi.MultiValueChildNodeTransformer
  field:
    name: region  
    fieldType: select
    label: Region
    options:            
      - name: north
        value: north
        label: North  
    
      - name: east
        value: east
        label: East

      - name: west
        value: west
        label: West

      - name: south 
        value: south
        label: South

Magnolia 5 UI framework compatibility issue

Now in your content app you'd create an item which has north and west as values in the region field. Then you create a new item below aforementioned item. First you'd notice that the values off the parent item are already entered in the form for this new item. If you now remove those and replace the values for the region field with south and east and save the form, you can observe that the values in the parent item have been also changed accordingly!

I've traced it down to an issue with JcrNewNodeAdapter which is itself not an actual JcrItem so that composite fields and such would end up reading/writing values to the parent item.

As a workaround i've sublcassed JcrContentConnector and modified it so that it'll create an actuall Jcr Node if it's asked for a new Item Id. I've attached the code in this issue.

Magnolia 6 new UI Framework incompatibility issue

  • Now in Magnolia 6 new UI Framework, we are missing an equivalent definition for MultiValueChildNodeTransformer. This makes customers having existing content cannot migrate to the new UI Framework. Content cannot be mapped and displayed properly anymore.

Workaround

  • A workaround for the new UI Framework to have backward compatibility is expected as a temporary solution.
     


 Comments   
Comment by Richard Gange [ 05/Mar/21 ]

Maybe it doesn't help here but I just wanted to mention this page Magnolia-6-UI-ports-of-5-UI-field-transformer-classes.html

Comment by Adam Siska [ 24/Mar/21 ]

(DOC update) new deprecated item provider was introduced, manual config in new ui shouldn't be needed (see example def.), i18n is supported (at multi field level):

multiValue:
  $type: jcrMultiValueField
  # i18n: true
  itemProvider:
    class: info.magnolia.ui.editor.MultiValueAsMultipleProperties$Definition
  field:
    $type: textField
Generated at Mon Feb 12 09:24:03 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.