Skip to content
Snippets Groups Projects
Commit 807e5cdb authored by colemanw's avatar colemanw
Browse files

Search ext: Ensure all entities have titlePlural to fix sort/display

parent c419e6ed
Branches
Tags
No related merge requests found
......@@ -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',
......
......@@ -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']],
......
......@@ -10,7 +10,7 @@
<hr />
<div class="buttons pull-right">
<button type="button" ng-click="$ctrl.cancel()" class="btn btn-danger">{{:: ts('Cancel') }}</button>
<button ng-click="$ctrl.save()" class="btn btn-primary" ng-disabled="!$ctrl.values.length">{{:: ts('Update %1 %2', {1: model.ids.length, 2: $ctrl.entity.title}) }}</button>
<button ng-click="$ctrl.save()" class="btn btn-primary" ng-disabled="!$ctrl.values.length">{{:: ts('Update %1 %2', {1: model.ids.length, 2: (model.ids.length === 1 ? $ctrl.entity.title : $ctrl.entity.titlePlural)}) }}</button>
</div>
</div>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment