Magnolia CMS Content App 多值和复合字段错误
Posted
技术标签:
【中文标题】Magnolia CMS Content App 多值和复合字段错误【英文标题】:Magnolia CMS Content App Multivalue and composite field error 【发布时间】:2020-04-30 09:45:23 【问题描述】:当我在内容应用程序中使用多值和复合字段时遇到奇怪的问题,数据未正确存储在 JCR 中,使用转换器类时未出现错误但未保存数据。
以下是我的灯光模块编辑器部分
editor:
class: info.magnolia.editor.app.ContentEditorSubAppDescriptor
actions:
close:
class: info.magnolia.editor.action.CloseContentEditorActionDefinition
save:
class: info.magnolia.editor.action.SaveContentActionDefinition
saveAndPublish:
class: info.magnolia.editor.action.SaveContentActionDefinition
onSuccessAction:
class: info.magnolia.ui.framework.action.ActivationActionDefinition
command: activate
contentConnector:
workspace: rules
$type: jcrDatasource
nodeTypes:
- icon: icon-node-content
name: mgnl:content
strict: false
- icon: icon-folder-l
name: mgnl:folder
strict: false
contentDefinition:
outlineFields:
jcrName:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
required: true
styleName: title
range:
class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
collapsed: true
fields:
- name: rangeList
fieldType: multiValue
transformerClass: info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueFieldTransformer
label: Range1
field:
name: rangeComponent
fieldType: composite
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
fields:
- name: title
fieldType: text
label: Title1
- name: title2
fieldType: text
label: Title2
equals:
class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
name: equalList
collapsed: true
fields:
equals:
name: equalComponent
fieldType: multiValue
class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
buttonSelectAddLabel: field.link.select.add
field:
name: equalElement
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
fieldType: text
blocks:
- text
initialBlock: text
linkableApps:
- pages
- assets
相等部分按预期工作,但具有复合部分的范围部分未存储数据。
【问题讨论】:
【参考方案1】:也许问题在于您在 multiValue 字段中使用的 transformerClass。试试DelegatingMultiValueSubnodeTransformer
:
- name: rangeList
fieldType: multiValue
transformerClass: info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueSubnodeTransformer
label: Range1
field:
name: rangeComponent
fieldType: composite
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
fields:
- name: title
fieldType: text
label: Title1
- name: title2
fieldType: text
label: Title2
希望对你有所帮助;)
【讨论】:
谢谢西蒙娜。它对我不起作用。但是我将我的应用程序 YAML 从“编辑器”转换为“基于表单的详细信息”结构,并且 Transformer 开始工作了。以上是关于Magnolia CMS Content App 多值和复合字段错误的主要内容,如果未能解决你的问题,请参考以下文章
Magnolia CMS : 介绍 Magnolia 教程不适用于 Magnolia CE 和 EE
将 Magnolia CMS 加密密码迁移到 Joomla CMS?