[#7312] excluded id from the excerpt list
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user