我为我的Apostrophe CMS部署设置了一些关系值,但这些值无法保存。我看到字段显示出来,并且我能够填充它们,但是当我保存项目时,这些值消失了。我没有收到任何错误信息,也没有出现任何故障。下面是我在组件的index.js中的beforeConstruct的内容。
options.addFields = [
{
name: '_linkPage',
label: 'Case Study',
type: 'joinByOne',
withType: 'apostrophe-page',
idField: 'pageId',
required: true,
help: 'Please pick a Case Study',
filters: {
projection: {
title: 1,
slug: 1,
type: 1,
tags: 1,
pageHeader: 1,
pageThumbnails: 1
}
},
relationshipsField: '_cardData',
relationship: [
{
name: 'cardTitle',
label: 'Card Title (override)',
type: 'string',
inline: true
},
{
name: 'cardText',
label: 'Card Text (override)',
type: 'string',
inline: true
}
]
}
].concat(options.addFields || []);
}
这是我的撇号和撇号相关项目的版本。
"apostrophe": "2.99.0",
"apostrophe-groups": "^0.5.34",
"apostrophe-link-widgets": "^1.0.5",
"apostrophe-monitor": "^2.0.5",
"apostrophe-workflow": "2.25.0"
如果有任何建议或帮助,我将非常感激。我更愿意用这种方式来管理数据。
在 relationship
模式字段属性只在 joinByArray
模式域.
a joinByOne
关系,理论上你可以设置任何相关的属性(比如你的 cardText
)直接在片上做连接,因为只有一个关系。在一个 joinByArray
字段,当你加入到多个不同的文档时,这些关系中的每一个可能都应该有自己的属性来帮助描述关系,所以额外的字段是可用的。