From aec8356e584fe308bc88ce9b8af82938d9134762 Mon Sep 17 00:00:00 2001 From: colemanw Date: Wed, 30 Aug 2023 14:26:35 -0400 Subject: [PATCH] Afform - Add field titles to metadata --- ext/afform/core/Civi/Api4/Afform.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/ext/afform/core/Civi/Api4/Afform.php b/ext/afform/core/Civi/Api4/Afform.php index d1316c20c6..58347df675 100644 --- a/ext/afform/core/Civi/Api4/Afform.php +++ b/ext/afform/core/Civi/Api4/Afform.php @@ -4,6 +4,7 @@ namespace Civi\Api4; use Civi\Api4\Generic\AutocompleteAction; use Civi\Api4\Generic\BasicGetFieldsAction; +use CRM_Afform_ExtensionUtil as E; /** * User-configurable forms. @@ -132,85 +133,105 @@ class Afform extends Generic\AbstractEntity { $fields = [ [ 'name' => 'name', + 'title' => E::ts('Name'), ], [ 'name' => 'type', + 'title' => E::ts('Type'), 'pseudoconstant' => ['optionGroupName' => 'afform_type'], ], [ 'name' => 'requires', + 'title' => E::ts('Requires'), 'data_type' => 'Array', ], [ 'name' => 'entity_type', + 'title' => E::ts('Block Entity'), 'description' => 'Block used for this entity type', ], [ 'name' => 'join_entity', + 'title' => E::ts('Join Entity'), 'description' => 'Used for blocks that join a sub-entity (e.g. Emails for a Contact)', ], [ 'name' => 'title', + 'title' => E::ts('Title'), 'required' => $self->getAction() === 'create', ], [ 'name' => 'description', + 'title' => E::ts('Description'), ], [ 'name' => 'is_dashlet', + 'title' => E::ts('Dashboard Dashlet'), 'data_type' => 'Boolean', ], [ 'name' => 'is_public', + 'title' => E::ts('Is Public'), 'data_type' => 'Boolean', ], [ 'name' => 'is_token', + 'title' => E::ts('Generate Tokens'), 'data_type' => 'Boolean', ], [ 'name' => 'contact_summary', + 'title' => E::ts('Contact Summary'), 'data_type' => 'String', 'options' => [ - 'block' => ts('Contact Summary Block'), - 'tab' => ts('Contact Summary Tab'), + 'block' => E::ts('Contact Summary Block'), + 'tab' => E::ts('Contact Summary Tab'), ], ], [ 'name' => 'summary_contact_type', + 'title' => E::ts('Summary Contact Type'), 'data_type' => 'Array', 'options' => \CRM_Contact_BAO_ContactType::contactTypePairs(), ], [ 'name' => 'icon', + 'title' => E::ts('Icon'), 'description' => 'Icon shown in the contact summary tab', ], [ 'name' => 'server_route', + 'title' => E::ts('Page Route'), ], [ 'name' => 'permission', + 'title' => E::ts('Permission'), 'data_type' => 'Array', ], [ 'name' => 'permission_operator', + 'title' => E::ts('Permission Operator'), 'data_type' => 'String', 'options' => \CRM_Core_SelectValues::andOr(), ], [ 'name' => 'redirect', + 'title' => E::ts('Post-Submit Page'), ], [ 'name' => 'create_submission', + 'title' => E::ts('Log Submissions'), 'data_type' => 'Boolean', ], [ 'name' => 'navigation', + 'title' => E::ts('Navigation Menu'), 'data_type' => 'Array', 'description' => 'Insert into navigation menu {parent: string, label: string, weight: int}', ], [ 'name' => 'layout', + 'title' => E::ts('Layout'), 'data_type' => 'Array', 'description' => 'HTML form layout; format is controlled by layoutFormat param', ], @@ -220,11 +241,13 @@ class Afform extends Generic\AbstractEntity { $fields[] = [ 'name' => 'module_name', 'type' => 'Extra', + 'description' => 'Name of generated Angular module (CamelCase)', 'readonly' => TRUE, ]; $fields[] = [ 'name' => 'directive_name', 'type' => 'Extra', + 'description' => 'Html tag name to invoke this form (dash-case)', 'readonly' => TRUE, ]; $fields[] = [ -- 2.25.1