SearchKit - Use label_field to determine column to output as link
authorColeman Watts <coleman@civicrm.org>
Sat, 6 Feb 2021 21:05:40 +0000 (16:05 -0500)
committerColeman Watts <coleman@civicrm.org>
Sat, 6 Feb 2021 21:05:40 +0000 (16:05 -0500)
ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js

index 91ae716ff24c8aa19a9ab7d5d6eb1edc8d65b46d..bbbb885ae55e91c13945c54120fefe0f8308d46f 100644 (file)
           return value;
         }
         // Output user-facing name/label fields as a link, if possible
-        if (info.field && _.includes(['display_name', 'title', 'label', 'subject'], info.field.name) && !info.fn && typeof value === 'string') {
+        if (info.field && info.field.name === searchMeta.getEntity(info.field.entity).label_field && !info.fn && typeof value === 'string') {
           var link = getEntityUrl(row, info);
           if (link) {
             return '<a href="' + _.escape(link.url) + '" title="' + _.escape(link.title) + '">' + formatFieldValue(info.field, value) + '</a>';