fix: nested media field media_folder evaluation
This commit is contained in:
parent
dcb01639f3
commit
14fef52913
@ -174,6 +174,7 @@ function traverseFields<EF extends BaseField>(
|
|||||||
| ListField
|
| ListField
|
||||||
| ObjectField
|
| ObjectField
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
||||||
if (matchedField && isMediaField(folderKey, matchedField)) {
|
if (matchedField && isMediaField(folderKey, matchedField)) {
|
||||||
return folderFormatter(
|
return folderFormatter(
|
||||||
matchedField[folderKey] ? matchedField[folderKey]! : `{{${folderKey}}}`,
|
matchedField[folderKey] ? matchedField[folderKey]! : `{{${folderKey}}}`,
|
||||||
@ -185,12 +186,7 @@ function traverseFields<EF extends BaseField>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const f of fields) {
|
for (const childField of fields) {
|
||||||
const childField: Field<EF> = { ...f };
|
|
||||||
if (isMediaField(folderKey, childField) && !childField[folderKey]) {
|
|
||||||
// add identity template if doesn't exist
|
|
||||||
childField[folderKey] = `{{${folderKey}}}`;
|
|
||||||
}
|
|
||||||
const folder = folderFormatter(
|
const folder = folderFormatter(
|
||||||
isMediaField(folderKey, childField) ? childField[folderKey] ?? '' : '',
|
isMediaField(folderKey, childField) ? childField[folderKey] ?? '' : '',
|
||||||
entryMap,
|
entryMap,
|
||||||
@ -206,7 +202,7 @@ function traverseFields<EF extends BaseField>(
|
|||||||
config,
|
config,
|
||||||
collection,
|
collection,
|
||||||
entryMap,
|
entryMap,
|
||||||
childField,
|
field,
|
||||||
childField.fields,
|
childField.fields,
|
||||||
folder,
|
folder,
|
||||||
);
|
);
|
||||||
@ -216,7 +212,7 @@ function traverseFields<EF extends BaseField>(
|
|||||||
config,
|
config,
|
||||||
collection,
|
collection,
|
||||||
entryMap,
|
entryMap,
|
||||||
childField,
|
field,
|
||||||
childField.types,
|
childField.types,
|
||||||
folder,
|
folder,
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user