I'm on 6.5.2 - Using the SPA Editor for Angular. Coral 3 for authoring dialog.
I created create a simple Angular component and mapped it an AEM Component. My AEM Component has an authoring dialog that has two multifields:
1) Multifield One : (Partial Snippet of Dialog)
<link sling:resourceType="granite/ui/components/coral/foundation/form/multifield" fieldDescription="Click '+' to add a new link" fieldLabel="Links" jcr:primaryType="nt:unstructured" composite="{Boolean}true">
<field sling:resourceType="granite/ui/components/coral/foundation/container" jcr:primaryType="nt:unstructured" name="./links">
<items jcr:primaryType="nt:unstructured">
<linkText jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" fieldLabel="CTA Text" required="true" name="./linkText" />
<linkPath jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" fieldLabel="CTA Link Path" required="true" name="./linkPath" />
<linkTarget jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" fieldLabel="CTA Link Target" name="./linkTarget">
<items jcr:primaryType="nt:unstructured">
<same jcr:primaryType="nt:unstructured" text="Same window" value="" />
<new jcr:primaryType="nt:unstructured" text="New window" value="_blank" />
</items>
</linkTarget>
</items>
</field>
</link>
2) Simplified Multifield
<headlines jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/multifield" fieldDescription="Click 'Add field' to add new content dropdown." fieldLabel="Headlines">
<field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" required="true" name="./headlines" />
</headlines>
In the SPA editor, I can update the authoring dialog fields for both multifields and can see the changes reflected in the JCR through CRX. What I do not see is updates to Multifield One in the model.json. But I can see updates to Simplified Multifield updating in the model.json.
I'm curious... Why do complex multifields get ignored by the Model.json (provided by JS SDK)?
Providing sample files: Sample Component Files
1. en.model.json - Highlighted section with missing child nodes
2. zip file with content and dialog
Solved! Go to Solution.
I had assumed that you have an exporter associated with your resource type, but it seems you do not, and that is the issue.
To understand this better, please refer to: https://docs.adobe.com/content/help/en/experience-manager-learn/foundation/development/understand-sl...
and
https://sling.apache.org/documentation/bundles/models.html#exporter-framework-since-1-3-0-
This is also an excellent resource on how to build exporters with examples:
https://docs.adobe.com/content/help/en/experience-manager-learn/foundation/development/develop-sling...
It seems that, by default, direct properties on the resource are exported, which is why you see other components working just fine. But for a composite multifield, the data is saved as child node, and the default exporter does not handle that. I assume because it assumes it's an irrelevant node.
basically, you do need to implement a sling model for your component, and add exporter annotations. Then grab the child nodes (saved by multifield) and export them.
Here is a, somewhat, related implementation:
https://github.com/adobe/aem-core-wcm-components/blob/c69fdc63fc0f2fb122d65eb4091d9bef872e09fb/bundl...
This returns a collection of "ListItem" (the real impl is "PageListItemImpl.java")
Hope this helps! Give it a shot, and post the Model you used here if you run into any issues.
Views
Replies
Total Likes
I'm not sure this is actually related to the SPA editor, it could be a number of things.
To make this easier for us to debug and help. could you create a simple empty component, maybe in we-retail project, with a sample dialog that does not provide you the desired model.json output, then package that component?
We can then install that sample component and play with it locally to determine the issue you are seeing.
Thanks!
Views
Replies
Total Likes
Views
Replies
Total Likes
I had assumed that you have an exporter associated with your resource type, but it seems you do not, and that is the issue.
To understand this better, please refer to: https://docs.adobe.com/content/help/en/experience-manager-learn/foundation/development/understand-sl...
and
https://sling.apache.org/documentation/bundles/models.html#exporter-framework-since-1-3-0-
This is also an excellent resource on how to build exporters with examples:
https://docs.adobe.com/content/help/en/experience-manager-learn/foundation/development/develop-sling...
It seems that, by default, direct properties on the resource are exported, which is why you see other components working just fine. But for a composite multifield, the data is saved as child node, and the default exporter does not handle that. I assume because it assumes it's an irrelevant node.
basically, you do need to implement a sling model for your component, and add exporter annotations. Then grab the child nodes (saved by multifield) and export them.
Here is a, somewhat, related implementation:
https://github.com/adobe/aem-core-wcm-components/blob/c69fdc63fc0f2fb122d65eb4091d9bef872e09fb/bundl...
This returns a collection of "ListItem" (the real impl is "PageListItemImpl.java")
Hope this helps! Give it a shot, and post the Model you used here if you run into any issues.
Views
Replies
Total Likes
@claudiab1560191
Multifield data won't be available in JSON exported by default.
You need to create a separate class for the fields which are there in multifield,
Inject the resource of the multifield in the main model class and adapt the multifiled java class in the main model class.
Thanks,
Nikhil
Views
Replies
Total Likes