就像核心的Accordion和Carousel组件一样,你可以打开组件对话框,通过点击多字段上的 "添加 "按钮来添加自定义嵌套组件。我正试图在我的自定义组件的对话框中添加这个功能。
在我的对话框的.content.xml中,我的多字段或子字段编辑器有这样的片段。
<slides
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/commons/editor/dialog/childreneditor/v1/childreneditor"/>
在这个文件的顶部,我有
extraClientlibs="
[my_custom_clientlibs,core.wcm.components.commons.editor.dialog.childreneditor.v1]
问题是当我点击我的新组件上的对话框的添加按钮时,什么也没有弹出。
我在这里遗漏了什么?
我想你缺少的是添加 sling:resourceSuperType = core/wcm/components/carousel/v1/carousel
到您的自定义组件中。
如果你不想覆盖,那么在你的组件HTL文件中添加以下代码。
<sly data-sly-resource="${resource.path @ resourceType='wcm/foundation/components/parsys/newpar', appendPath='/*', decorationTagName='div', cssClassName='new section aem-Grid-newComponent'}"
data-sly-test="${(wcmmode.edit || wcmmode.preview)}"></sly>
这是因为你在newpar里面插入了一个子组件。