From 5e63eeaf96cefea469ccf0fb0a7f8973d6d964d8 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 5 Apr 2023 14:53:53 -0400 Subject: [PATCH] APIv4 - Fix customValue fieldSpec to include input types & labels --- .../Spec/Provider/CustomValueSpecProvider.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php b/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php index c4c1cb8a2b..2cb57becd1 100644 --- a/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php +++ b/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php @@ -26,21 +26,24 @@ class CustomValueSpecProvider extends \Civi\Core\Service\AutoService implements */ public function modifySpec(RequestSpec $spec) { $action = $spec->getAction(); - if ($action !== 'create') { - $idField = new FieldSpec('id', $spec->getEntity(), 'Integer'); - $idField->setType('Field'); - $idField->setColumnName('id'); - $idField->setTitle(ts('Custom Value ID')); - $idField->setReadonly(TRUE); - $spec->addFieldSpec($idField); - } + + $idField = new FieldSpec('id', $spec->getEntity(), 'Integer'); + $idField->setType('Field'); + $idField->setInputType('Number'); + $idField->setColumnName('id'); + $idField->setTitle(ts('Custom Value ID')); + $idField->setReadonly(TRUE); + $spec->addFieldSpec($idField); + $entityField = new FieldSpec('entity_id', $spec->getEntity(), 'Integer'); $entityField->setType('Field'); $entityField->setColumnName('entity_id'); $entityField->setTitle(ts('Entity ID')); + $entityField->setLabel(ts('Contact')); $entityField->setRequired($action === 'create'); $entityField->setFkEntity('Contact'); $entityField->setReadonly(TRUE); + $entityField->setInputType('EntityRef'); $spec->addFieldSpec($entityField); } -- 2.25.1