use the presentable prop when displaying relations

This commit is contained in:
Gani Georgiev
2023-08-21 18:06:35 +03:00
parent 26fd3d48df
commit f0af24d78f
8 changed files with 32 additions and 77 deletions
+8 -4
View File
@@ -1414,8 +1414,10 @@ export default class CommonHelper {
/**
* Tries to output the first displayable field of the provided model.
*
* @param {Object} model
* @return {Any}
* @param {Object} model
* @param {Array<string>} displayFields
* @param {String} [missingValue]
* @return {String}
*/
static displayValue(model, displayFields, missingValue = "N/A") {
model = model || {};
@@ -1423,8 +1425,8 @@ export default class CommonHelper {
let result = [];
for (const field of displayFields) {
let val = model[field];
for (const prop of displayFields) {
let val = model[prop];
if (typeof val === "undefined") {
continue
@@ -1445,10 +1447,12 @@ export default class CommonHelper {
"slug",
"email",
"username",
"nickname",
"label",
"heading",
"message",
"key",
"identifier",
"id",
];