mirror of
https://github.com/strapi/strapi.git
synced 2025-11-04 11:54:10 +00:00
Allow default mainField on relation
This commit is contained in:
parent
8c1f25a058
commit
c3a59c4c4b
@ -33,19 +33,24 @@ function createDefaultMetadata(schema, name) {
|
|||||||
placeholder: '',
|
placeholder: '',
|
||||||
visible: isVisible(schema, name),
|
visible: isVisible(schema, name),
|
||||||
editable: true,
|
editable: true,
|
||||||
..._.pick(_.get(schema, ['config', 'metadatas', name, 'edit'], {}), [
|
|
||||||
'label',
|
|
||||||
'description',
|
|
||||||
'placeholder',
|
|
||||||
'visible',
|
|
||||||
'editable',
|
|
||||||
]),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isRelation(schema.attributes[name])) {
|
if (isRelation(schema.attributes[name])) {
|
||||||
edit.mainField = 'id';
|
edit.mainField = 'id';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_.assign(
|
||||||
|
edit,
|
||||||
|
_.pick(_.get(schema, ['config', 'metadatas', name, 'edit'], {}), [
|
||||||
|
'label',
|
||||||
|
'description',
|
||||||
|
'placeholder',
|
||||||
|
'visible',
|
||||||
|
'editable',
|
||||||
|
'mainField',
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
const list = {
|
const list = {
|
||||||
label: _.upperFirst(name),
|
label: _.upperFirst(name),
|
||||||
searchable: isSearchable(schema, name),
|
searchable: isSearchable(schema, name),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user