From 6ec1913f648164660835a2fb3b5b82a80a71cc2c Mon Sep 17 00:00:00 2001 From: Alain Benbassat Date: Wed, 12 Oct 2022 13:08:03 +0100 Subject: [PATCH] Profiles - Update metadata with titles and paths for SearchKit Metadata allows Profiles to be searched for in SearchKit --- CRM/Core/DAO/UFField.php | 16 ++++++++++++++-- CRM/Core/DAO/UFGroup.php | 19 +++++++++++++++++-- CRM/Core/DAO/UFJoin.php | 4 ++-- CRM/UF/Form/Field.php | 5 +++++ Civi/Api4/UFField.php | 1 - Civi/Api4/UFGroup.php | 1 - Civi/Api4/UFJoin.php | 2 +- xml/schema/Core/UFField.xml | 7 +++++++ xml/schema/Core/UFGroup.xml | 10 ++++++++++ xml/schema/Core/UFJoin.xml | 1 + 10 files changed, 57 insertions(+), 9 deletions(-) diff --git a/CRM/Core/DAO/UFField.php b/CRM/Core/DAO/UFField.php index 7fba31dc6d..5e9979ce93 100644 --- a/CRM/Core/DAO/UFField.php +++ b/CRM/Core/DAO/UFField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:2de519ddf9c147c5716678f35b566cd7) + * (GenCodeChecksum:0982114cb58272a51643c9e8738e40d4) */ /** @@ -30,6 +30,18 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO { */ public static $_log = TRUE; + /** + * Paths for accessing this entity in the UI. + * + * @var string[] + */ + protected static $_paths = [ + 'add' => 'civicrm/admin/uf/group/field/add?reset=1&action=add&gid=[uf_group_id]', + 'preview' => 'civicrm/admin/uf/group/preview?reset=1&gid=[uf_group_id]&fieldId=[id]', + 'update' => 'civicrm/admin/uf/group/field/update?reset=1&action=update&id=[id]', + 'delete' => 'civicrm/admin/uf/group/field/update?reset=1&action=delete&id=[id]', + ]; + /** * Unique table ID * @@ -216,7 +228,7 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO { * Whether to return the plural version of the title. */ public static function getEntityTitle($plural = FALSE) { - return $plural ? ts('UFFields') : ts('UFField'); + return $plural ? ts('Profile Fields') : ts('Profile Field'); } /** diff --git a/CRM/Core/DAO/UFGroup.php b/CRM/Core/DAO/UFGroup.php index 87786570ef..3537ef3c1a 100644 --- a/CRM/Core/DAO/UFGroup.php +++ b/CRM/Core/DAO/UFGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:513714296a3ef044028606deeb7015f2) + * (GenCodeChecksum:fc9170f1bad42b21ea21305fa9cf7135) */ /** @@ -30,6 +30,18 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { */ public static $_log = TRUE; + /** + * Paths for accessing this entity in the UI. + * + * @var string[] + */ + protected static $_paths = [ + 'add' => 'civicrm/admin/uf/group/add?action=add&reset=1', + 'preview' => 'civicrm/admin/uf/group/preview?reset=1&gid=[id]', + 'update' => 'civicrm/admin/uf/group/update?action=update&reset=1&id=[id]', + 'delete' => 'civicrm/admin/uf/group/update?action=delete&reset=1&id=[id]', + ]; + /** * Unique table ID * @@ -286,7 +298,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { * Whether to return the plural version of the title. */ public static function getEntityTitle($plural = FALSE) { - return $plural ? ts('UFGroups') : ts('UFGroup'); + return $plural ? ts('Profiles') : ts('Profile'); } /** @@ -619,6 +631,9 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, + 'html' => [ + 'type' => 'Radio', + ], 'add' => '3.0', ], 'name' => [ diff --git a/CRM/Core/DAO/UFJoin.php b/CRM/Core/DAO/UFJoin.php index 1bf4c4cd84..3f805ee243 100644 --- a/CRM/Core/DAO/UFJoin.php +++ b/CRM/Core/DAO/UFJoin.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFJoin.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:d7cc3d08c4c2ea8b556a3590e94792a0) + * (GenCodeChecksum:bb54d87bfa1cc4ad4cdbe8ddb817be08) */ /** @@ -117,7 +117,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO { * Whether to return the plural version of the title. */ public static function getEntityTitle($plural = FALSE) { - return $plural ? ts('UFJoins') : ts('UFJoin'); + return $plural ? ts('Profile Uses') : ts('Profile Use'); } /** diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 56ceef8590..78c5978d65 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -78,6 +78,11 @@ class CRM_UF_Form_Field extends CRM_Core_Form { public function preProcess() { $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); + + if (!$this->_gid && $this->_id) { + $this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $this->_id, 'uf_group_id'); + $this->set('_gid', $this->_gid); + } if ($this->_gid) { $this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title'); diff --git a/Civi/Api4/UFField.php b/Civi/Api4/UFField.php index df435c595a..478f3abb40 100644 --- a/Civi/Api4/UFField.php +++ b/Civi/Api4/UFField.php @@ -14,7 +14,6 @@ namespace Civi\Api4; * UFField entity - aka profile fields. * * @see \Civi\Api4\UFGroup - * @searchable none * @orderBy weight * @groupWeightsBy uf_group_id * @since 5.19 diff --git a/Civi/Api4/UFGroup.php b/Civi/Api4/UFGroup.php index f97261ccbd..23539db3ad 100644 --- a/Civi/Api4/UFGroup.php +++ b/Civi/Api4/UFGroup.php @@ -14,7 +14,6 @@ namespace Civi\Api4; * UFGroup entity - AKA profiles. * * @see https://docs.civicrm.org/user/en/latest/organising-your-data/profiles/ - * @searchable none * @since 5.19 * @package Civi\Api4 */ diff --git a/Civi/Api4/UFJoin.php b/Civi/Api4/UFJoin.php index c9f235f411..2e45a2202e 100644 --- a/Civi/Api4/UFJoin.php +++ b/Civi/Api4/UFJoin.php @@ -14,7 +14,7 @@ namespace Civi\Api4; * UFJoin entity - links profiles to the components/extensions they are used for. * * @see \Civi\Api4\UFGroup - * @searchable none + * @searchable secondary * @since 5.19 * @package Civi\Api4 */ diff --git a/xml/schema/Core/UFField.xml b/xml/schema/Core/UFField.xml index 5620cd66fd..08de9489fa 100644 --- a/xml/schema/Core/UFField.xml +++ b/xml/schema/Core/UFField.xml @@ -7,6 +7,13 @@ User Framework fields and their properties. 1.1 true + Profile Field + + civicrm/admin/uf/group/field/add?reset=1&action=add&gid=[uf_group_id] + civicrm/admin/uf/group/preview?reset=1&gid=[uf_group_id]&fieldId=[id] + civicrm/admin/uf/group/field/update?reset=1&action=update&id=[id] + civicrm/admin/uf/group/field/update?reset=1&action=delete&id=[id] + id Profile Field ID diff --git a/xml/schema/Core/UFGroup.xml b/xml/schema/Core/UFGroup.xml index 26f1075fa7..1f001a2964 100644 --- a/xml/schema/Core/UFGroup.xml +++ b/xml/schema/Core/UFGroup.xml @@ -7,6 +7,13 @@ User framework groups. Each group represents a form which encompasses a set of fields defined in civicrm_uf_fields table. Initially will be used for CiviCRM Profile form(s). Subsequently we anticipate using this to define other public facing forms (e.g. online donation solicitation forms, mailing list preferences, etc.). 1.1 true + Profile + + civicrm/admin/uf/group/add?action=add&reset=1 + civicrm/admin/uf/group/preview?reset=1&gid=[id] + civicrm/admin/uf/group/update?action=update&reset=1&id=[id] + civicrm/admin/uf/group/update?action=delete&reset=1&id=[id] + id Profile ID @@ -220,6 +227,9 @@ boolean 0 true + + Radio + Is this group reserved for use by some other CiviCRM functionality? 3.0 diff --git a/xml/schema/Core/UFJoin.xml b/xml/schema/Core/UFJoin.xml index 8470e3b080..978380a567 100644 --- a/xml/schema/Core/UFJoin.xml +++ b/xml/schema/Core/UFJoin.xml @@ -7,6 +7,7 @@ User framework join table. This links various internal civicrm object with a profile. Initial use cases are the donation object and the user module 1.3 true + Profile Use id UF Join ID -- 2.25.1