[MGNLUI-6320] DOC: Using currentItemProvider in complex fields Created: 15/Oct/20 Updated: 29/Oct/20 Resolved: 29/Oct/20 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | None |
| Affects Version/s: | 6.2 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Neutral |
| Reporter: | Ashraf Khamis | Assignee: | Ashraf Khamis |
| Resolution: | Done | Votes: | 0 |
| Labels: | fields, new-UI-framework, new-form | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoR: |
Empty
|
||||||||||||||||
| Epic Link: | DOC: Restructure common field properties | ||||||||||||||||
| Sprint: | UI FW 14 | ||||||||||||||||
| Story Points: | 2 | ||||||||||||||||
| Description |
|
Check whether it is still good practice to use currentItemProvider with composite and switchable fields. We are already warning against its use with multi fields (see https://documentation.magnolia-cms.com/display/DOCS62/Item+providers#Itemproviders-Foranydatasource). If you use currentItemProvider with complex fields, make sure that none of the inner field names clash with:
In other words, when using currentItemProvider, every field at every level must have a unique name. Otherwise, nodes sharing the same name could be resolved by multiple fields that use currentItemProvider, which means their content would be overwritten. See the following example:
form:
properties:
one_compositeField:
$type: compositeField
itemProvider:
$type: currentItemProvider
properties:
inner_simple:
label: simple
$type: textField # first text
inner_simple2:
label: simple
$type: textField # second text
second_compositeField:
$type: compositeField
itemProvider:
$type: currentItemProvider
properties:
inner_simple:
label: simple
$type: textField # fourth text
inner_simple3:
label: simple
$type: textField # third text
# Problem:
Einstein:
inner_simple : fourth text # first text got overwritten
inner_simple2 : second text
inner_simple3: third text
# Using jcrChildNodeProvider in both would fix the problem:
Einstein:
one_compositeField:
inner_simple : first text
inner_simple2 : second text
second_compositeField:
inner_simple : fourth text
inner_simple2 : third text
|
| Comments |
| Comment by Ashraf Khamis [ 29/Oct/20 ] |
|
Updated https://documentation.magnolia-cms.com/display/DOCS62/Item+providers#Itemproviders-Foranydatasource with:
Reviewed by Šimon. |