fix(netlify-cms-core): fix identifier field validation (#1907)
This commit is contained in:
parent
5e2ce34c99
commit
d5f4c99002
@ -114,9 +114,11 @@ export const selectTemplateName = (collection, slug) =>
|
|||||||
selectors[collection.get('type')].templateName(collection, slug);
|
selectors[collection.get('type')].templateName(collection, slug);
|
||||||
export const selectIdentifier = collection => {
|
export const selectIdentifier = collection => {
|
||||||
const identifier = collection.get('identifier_field');
|
const identifier = collection.get('identifier_field');
|
||||||
const indentifierFields = identifier ? [identifier, ...IDENTIFIER_FIELDS] : IDENTIFIER_FIELDS;
|
const identifierFields = identifier ? [identifier, ...IDENTIFIER_FIELDS] : IDENTIFIER_FIELDS;
|
||||||
const fieldNames = collection.get('fields').map(field => field.get('name'));
|
const fieldNames = collection.get('fields').map(field => field.get('name'));
|
||||||
return indentifierFields.find(id => fieldNames.find(name => name.toLowerCase().trim() === id));
|
return identifierFields.find(id =>
|
||||||
|
fieldNames.find(name => name.toLowerCase().trim() === id.toLowerCase().trim()),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
export const selectInferedField = (collection, fieldName) => {
|
export const selectInferedField = (collection, fieldName) => {
|
||||||
const inferableField = INFERABLE_FIELDS[fieldName];
|
const inferableField = INFERABLE_FIELDS[fieldName];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user