[#7312] excluded id from the excerpt list

This commit is contained in:
Gani Georgiev
2025-11-08 23:31:03 +02:00
parent 501ab0e6be
commit 63a9d045a1
38 changed files with 83 additions and 50 deletions

View File

@@ -1774,7 +1774,7 @@ export default class CommonHelper {
/**
* Returns an array with all public collection identifiers (collection fields + type specific fields).
*
* @param {[type]} collection The collection to extract identifiers from.
* @param {Object} collection The collection to extract identifiers from.
* @param {String} prefix Optional prefix for each found identified.
* @return {Array}
*/
@@ -1804,6 +1804,30 @@ export default class CommonHelper {
return result;
}
/**
* Returns a wildcard "fields" string with the excerpt modifier applied to all collection fields
* (except the primary key and relation fields).
*
* @param {Object} collection
* @param {Number} [maxExcerpt]
* @return {String}
*/
static getExcerptCollectionFieldsList(collection, maxExcerpt = 200) {
let result = ["*"];
const fields = collection?.fields || [];
for (const field of fields) {
if (field.primaryKey || field.type == "relation") {
continue
}
result.push(`${field.name}:excerpt(${maxExcerpt})`);
}
return result.join(",");
}
/**
* Generates recursively a list with all the autocomplete field keys
* for the collectionNameOrId collection.