From 807e5cdbc3c46b7e6d7d9283c3d73826e5e3ae4c Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 9 Oct 2020 17:12:57 -0400 Subject: [PATCH] Search ext: Ensure all entities have titlePlural to fix sort/display --- Civi/Api4/Action/Entity/Get.php | 5 ++++- ext/search/CRM/Search/Page/Ang.php | 2 -- .../ang/search/crmSearchActions/crmSearchActionUpdate.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Civi/Api4/Action/Entity/Get.php b/Civi/Api4/Action/Entity/Get.php index 044105e4e5..2d14f325be 100644 --- a/Civi/Api4/Action/Entity/Get.php +++ b/Civi/Api4/Action/Entity/Get.php @@ -20,6 +20,7 @@ namespace Civi\Api4\Action\Entity; use Civi\Api4\CustomGroup; +use Civi\Api4\Service\Schema\Joinable\CustomGroupJoinable; /** * Get the names & docblocks of all APIv4 entities. @@ -91,10 +92,12 @@ class Get extends \Civi\Api4\Generic\BasicGetAction { ->execute(); foreach ($customEntities as $customEntity) { $fieldName = 'Custom_' . $customEntity['name']; + $baseEntity = '\Civi\Api4\\' . CustomGroupJoinable::getEntityFromExtends($customEntity['extends']); $entities[$fieldName] = [ 'name' => $fieldName, 'title' => $customEntity['title'], - 'description' => 'Custom group - extends ' . $customEntity['extends'], + 'titlePlural' => $customEntity['title'], + 'description' => ts('Custom group for %1', [1 => $baseEntity::getInfo()['titlePlural']]), 'see' => [ 'https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/#multiple-record-fieldsets', '\\Civi\\Api4\\CustomGroup', diff --git a/ext/search/CRM/Search/Page/Ang.php b/ext/search/CRM/Search/Page/Ang.php index 0c9c228f21..22cab1dcfa 100644 --- a/ext/search/CRM/Search/Page/Ang.php +++ b/ext/search/CRM/Search/Page/Ang.php @@ -99,8 +99,6 @@ class CRM_Search_Page_Ang extends CRM_Core_Page { if ($loadOptions) { $entity['optionsLoaded'] = TRUE; } - // Because multivalue custom pseudo-entities don't have titlePlural - $entity['titlePlural'] = $entity['titlePlural'] ?? $entity['title']; $entity['fields'] = civicrm_api4($entity['name'], 'getFields', [ 'select' => $getFields, 'where' => [['permission', 'IS NULL']], diff --git a/ext/search/ang/search/crmSearchActions/crmSearchActionUpdate.html b/ext/search/ang/search/crmSearchActions/crmSearchActionUpdate.html index 63178a0bae..fac9c10af2 100644 --- a/ext/search/ang/search/crmSearchActions/crmSearchActionUpdate.html +++ b/ext/search/ang/search/crmSearchActions/crmSearchActionUpdate.html @@ -10,7 +10,7 @@
- +
-- 2.25.1