From 6ec1913f648164660835a2fb3b5b82a80a71cc2c Mon Sep 17 00:00:00 2001 From: Alain Benbassat Date: Wed, 12 Oct 2022 13:08:03 +0100 Subject: [PATCH 1/2] 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 7fba31dc6d1b..5e9979ce93ee 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 @@ public function __construct() { * 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 87786570ef5e..3537ef3c1a3b 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 @@ public function __construct() { * 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 @@ public static function &fields() { '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 1bf4c4cd8418..3f805ee2431c 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 @@ public function __construct() { * 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 56ceef859004..78c5978d652f 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 df435c595a02..478f3abb40e7 100644 --- a/Civi/Api4/UFField.php +++ b/Civi/Api4/UFField.php @@ -14,7 +14,6 @@ * 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 f97261ccbdba..23539db3ad51 100644 --- a/Civi/Api4/UFGroup.php +++ b/Civi/Api4/UFGroup.php @@ -14,7 +14,6 @@ * 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 c9f235f411a3..2e45a2202e07 100644 --- a/Civi/Api4/UFJoin.php +++ b/Civi/Api4/UFJoin.php @@ -14,7 +14,7 @@ * 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 5620cd66fddd..08de9489fad3 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 26f1075fa7da..1f001a296417 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 8470e3b080b2..978380a56701 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 From 599e677571234b144b15791c37607bf28e4c3929 Mon Sep 17 00:00:00 2001 From: Alain Benbassat Date: Wed, 12 Oct 2022 14:00:55 +0100 Subject: [PATCH 2/2] AdminUI - Add SearchKit screen for Administer Profiles --- CRM/Core/xml/Menu/Admin.xml | 5 + CRM/UF/Form/Preview.php | 7 +- CRM/UF/Page/Field.php | 9 +- CRM/UF/Page/Group.php | 9 +- .../ang/afsearchProfileFields.aff.html | 3 + .../ang/afsearchProfileFields.aff.json | 18 ++ .../ang/afsearchProfiles.aff.html | 20 ++ .../ang/afsearchProfiles.aff.json | 18 ++ ...vedSearch_Administer_ProfileFields.mgd.php | 187 +++++++++++++ .../SavedSearch_Administer_Profiles.mgd.php | 258 ++++++++++++++++++ 10 files changed, 524 insertions(+), 10 deletions(-) create mode 100644 ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.html create mode 100644 ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.json create mode 100644 ext/civicrm_admin_ui/ang/afsearchProfiles.aff.html create mode 100644 ext/civicrm_admin_ui/ang/afsearchProfiles.aff.json create mode 100644 ext/civicrm_admin_ui/managed/SavedSearch_Administer_ProfileFields.mgd.php create mode 100644 ext/civicrm_admin_ui/managed/SavedSearch_Administer_Profiles.mgd.php diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index 0b6a477fa2de..b4c65b4391b9 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -65,6 +65,11 @@ Customize Data and Screens 20 + + civicrm/admin/uf/group/preview + Preview + CRM_UF_Form_Preview + civicrm/admin/uf/group/field CiviCRM Profile Fields diff --git a/CRM/UF/Form/Preview.php b/CRM/UF/Form/Preview.php index 7ef09e87a8d9..822951c675a0 100644 --- a/CRM/UF/Form/Preview.php +++ b/CRM/UF/Form/Preview.php @@ -33,11 +33,10 @@ class CRM_UF_Form_Preview extends CRM_UF_Form_AbstractPreview { */ public function preProcess() { $flag = FALSE; - $gid = $this->get('id'); - $this->set('gid', $gid); - $field = CRM_Utils_Request::retrieve('field', 'Boolean', $this, TRUE, 0); + $gid = CRM_Utils_Request::retrieve('gid', 'Integer', $this, TRUE); + $fieldId = CRM_Utils_Request::retrieve('fieldId', 'Integer', $this, FALSE, 0); - if ($field) { + if ($fieldId) { $fields = CRM_Core_BAO_UFGroup::getFields($gid, FALSE, NULL, NULL, NULL, TRUE); $fieldDAO = new CRM_Core_DAO_UFField(); $fieldDAO->id = $this->get('fieldId'); diff --git a/CRM/UF/Page/Field.php b/CRM/UF/Page/Field.php index 1c3e59d09edb..b939f01fc5d3 100644 --- a/CRM/UF/Page/Field.php +++ b/CRM/UF/Page/Field.php @@ -57,8 +57,8 @@ public static function &actionLinks() { ], CRM_Core_Action::PREVIEW => [ 'name' => ts('Preview'), - 'url' => 'civicrm/admin/uf/group/field', - 'qs' => 'action=preview&id=%%id%%&field=1', + 'url' => 'civicrm/admin/uf/group/preview', + 'qs' => 'action=preview&gid=%%gid%%&fieldId=%%id%%', 'title' => ts('Preview CiviCRM Profile Field'), ], CRM_Core_Action::DISABLE => [ @@ -259,6 +259,9 @@ public function run() { /** * Preview custom field. * + * @deprecated + * Links should point directly to civicrm/admin/uf/group/preview + * * @param int $fieldId * Custom field id. * @param int $groupId @@ -272,7 +275,7 @@ public function preview($fieldId, $groupId) { 'reset=1&action=browse&gid=' . $this->_gid )); $controller->set('fieldId', $fieldId); - $controller->set('id', $groupId); + $controller->set('gid', $groupId); $controller->setEmbedded(TRUE); $controller->process(); $controller->run(); diff --git a/CRM/UF/Page/Group.php b/CRM/UF/Page/Group.php index c3b35bc0bb5e..e5bb967aaea1 100644 --- a/CRM/UF/Page/Group.php +++ b/CRM/UF/Page/Group.php @@ -59,8 +59,8 @@ public static function &actionLinks() { ], CRM_Core_Action::PREVIEW => [ 'name' => ts('Preview'), - 'url' => 'civicrm/admin/uf/group', - 'qs' => 'action=preview&id=%%id%%&field=0&context=group', + 'url' => 'civicrm/admin/uf/group/preview', + 'qs' => 'action=preview&gid=%%id%%&context=group', 'title' => ts('Edit CiviCRM Profile Group'), ], CRM_Core_Action::ADD => [ @@ -372,6 +372,9 @@ public function browse($action = NULL) { /** * for preview mode for ufoup. * + * @deprecated + * Links should point directly to civicrm/admin/uf/group/preview + * * @param int $id * Uf group id. * @@ -379,7 +382,7 @@ public function browse($action = NULL) { */ public function preview($id, $action) { $controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Preview', ts('CiviCRM Profile Group Preview'), NULL); - $controller->set('id', $id); + $controller->set('gid', $id); $controller->setEmbedded(TRUE); $controller->process(); $controller->run(); diff --git a/ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.html b/ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.html new file mode 100644 index 000000000000..85180ed32d5e --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.json b/ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.json new file mode 100644 index 000000000000..050dd2d1bf8f --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchProfileFields.aff.json @@ -0,0 +1,18 @@ +{ + "type": "search", + "requires": [], + "entity_type": null, + "join_entity": null, + "title": "Profile Fields", + "description": "", + "is_dashlet": false, + "is_public": false, + "is_token": false, + "contact_summary": null, + "icon": "fa-list-alt", + "server_route": "civicrm/admin/uf/group/field", + "permission": "access CiviCRM", + "redirect": null, + "create_submission": false, + "navigation": null +} diff --git a/ext/civicrm_admin_ui/ang/afsearchProfiles.aff.html b/ext/civicrm_admin_ui/ang/afsearchProfiles.aff.html new file mode 100644 index 000000000000..6fffa3ea28dc --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchProfiles.aff.html @@ -0,0 +1,20 @@ +
+
+ + + + +
{{:: ts('CiviCRM Profile(s) allow you to aggregate groups of fields and include them in your site as input forms, contact display pages, and search and listings features. They provide a powerful set of tools for you to collect information from constituents and selectively share contact information.') }} {{:: ts('Learn more...') }}
+ + + + + +
+
+
+ + +
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchProfiles.aff.json b/ext/civicrm_admin_ui/ang/afsearchProfiles.aff.json new file mode 100644 index 000000000000..9be0002e901c --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchProfiles.aff.json @@ -0,0 +1,18 @@ +{ + "type": "search", + "requires": [], + "entity_type": null, + "join_entity": null, + "title": "Profiles", + "description": "", + "is_dashlet": false, + "is_public": false, + "is_token": false, + "contact_summary": null, + "icon": "fa-list-alt", + "server_route": "civicrm/admin/uf/group", + "permission": "access CiviCRM", + "redirect": null, + "create_submission": false, + "navigation": null +} diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_ProfileFields.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_ProfileFields.mgd.php new file mode 100644 index 000000000000..fafeaae766df --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_ProfileFields.mgd.php @@ -0,0 +1,187 @@ + 'SavedSearch_Profile_Fields', + 'entity' => 'SavedSearch', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Profile_Fields', + 'label' => E::ts('Administer Profile Fields'), + 'form_values' => NULL, + 'mapping_id' => NULL, + 'search_custom_id' => NULL, + 'api_entity' => 'UFField', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'id', + 'label', + 'visibility:label', + 'is_searchable', + 'is_required', + 'is_view', + 'is_reserved', + 'is_active', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [], + 'join' => [], + 'having' => [], + ], + 'expires_date' => NULL, + 'description' => NULL, + ], + ], + ], + [ + 'name' => 'SavedSearch_Profile_Fields_SearchDisplay_Profile_Fields', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Profile_Fields', + 'label' => E::ts('Table'), + 'saved_search_id.name' => 'Profile_Fields', + 'type' => 'table', + 'settings' => [ + 'actions' => FALSE, + 'limit' => 50, + 'classes' => [ + 'table', + 'table-striped', + ], + 'pager' => [], + 'placeholder' => 5, + 'sort' => [], + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'label', + 'dataType' => 'String', + 'label' => E::ts('Field Name'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'visibility:label', + 'dataType' => 'String', + 'label' => E::ts('Visibility'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_searchable', + 'dataType' => 'Boolean', + 'label' => E::ts('Searchable'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_required', + 'dataType' => 'Boolean', + 'label' => E::ts('Required'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_active', + 'dataType' => 'Boolean', + 'label' => E::ts('Enabled'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_view', + 'dataType' => 'Boolean', + 'label' => E::ts('View Only'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_reserved', + 'dataType' => 'Boolean', + 'label' => E::ts('Reserved'), + 'sortable' => TRUE, + 'rewrite' => ' ', + 'icons' => [ + [ + 'icon' => 'fa-lock', + 'side' => 'left', + 'if' => ['is_reserved', '=', TRUE], + ], + ], + ], + [ + 'size' => 'btn-xs', + 'links' => [ + [ + 'entity' => 'UFField', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => E::ts('Edit'), + 'style' => 'default', + 'path' => '', + 'condition' => [], + ], + [ + 'entity' => 'UFField', + 'action' => 'preview', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-eye', + 'text' => E::ts('Preview'), + 'style' => 'default', + 'condition' => ['is_active', '=', TRUE], + ], + [ + 'entity' => 'UFField', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => E::ts('Delete'), + 'style' => 'danger', + 'path' => '', + 'condition' => [], + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + ], + 'draggable' => 'weight', + 'button' => NULL, + 'addButton' => [ + 'path' => 'civicrm/admin/uf/group/field/add?reset=1&action=add&gid=[uf_group_id]', + 'text' => E::ts('Add Field'), + 'icon' => 'fa-plus', + ], + 'cssRules' => [ + [ + 'disabled', + 'is_active', + '=', + FALSE, + ], + ], + ], + 'acl_bypass' => FALSE, + ], + ], + ], +]; diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Profiles.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Profiles.mgd.php new file mode 100644 index 000000000000..1d80774b45a5 --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Profiles.mgd.php @@ -0,0 +1,258 @@ + 'SavedSearch_User_defined_Profiles', + 'entity' => 'SavedSearch', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'User_defined_Profiles', + 'label' => E::ts('Administer Profiles'), + 'form_values' => NULL, + 'mapping_id' => NULL, + 'search_custom_id' => NULL, + 'api_entity' => 'UFGroup', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'id', + 'title', + 'frontend_title', + 'created_id.display_name', + 'description', + 'group_type', + 'is_reserved', + 'is_active', + 'COUNT(UFGroup_UFField_uf_group_id_01.id) AS COUNT_UFGroup_UFField_uf_group_id_01_id', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [ + 'id', + ], + 'join' => [ + [ + 'UFField AS UFGroup_UFField_uf_group_id_01', + 'LEFT', + [ + 'id', + '=', + 'UFGroup_UFField_uf_group_id_01.uf_group_id', + ], + ], + ], + 'having' => [], + ], + 'expires_date' => NULL, + 'description' => NULL, + ], + ], + ], + [ + 'name' => 'SavedSearch_User_defined_Profiles_SearchDisplay_User_defined_Profiles', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'User_defined_Profiles', + 'label' => E::ts('Administer Profiles'), + 'saved_search_id.name' => 'User_defined_Profiles', + 'type' => 'table', + 'settings' => [ + 'actions' => FALSE, + 'limit' => 50, + 'classes' => [ + 'table', + 'table-striped', + ], + 'pager' => [], + 'placeholder' => 5, + 'sort' => [], + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'id', + 'dataType' => 'String', + 'label' => E::ts('ID'), + 'sortable' => TRUE, + 'editable' => FALSE, + ], + [ + 'type' => 'field', + 'key' => 'title', + 'dataType' => 'String', + 'label' => E::ts('Profile Title'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'frontend_title', + 'dataType' => 'String', + 'label' => E::ts('Public Title'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'created_id.display_name', + 'dataType' => 'String', + 'label' => E::ts('Created By'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'description', + 'dataType' => 'Text', + 'label' => E::ts('Description'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'group_type', + 'dataType' => 'String', + 'label' => E::ts('Type'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_active', + 'dataType' => 'Boolean', + 'label' => E::ts('Enabled'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_reserved', + 'dataType' => 'Boolean', + 'label' => E::ts('Reserved'), + 'sortable' => TRUE, + 'rewrite' => ' ', + 'icons' => [ + [ + 'icon' => 'fa-lock', + 'side' => 'left', + 'if' => ['is_reserved', '=', TRUE], + ], + ], + ], + [ + 'size' => 'btn-xs', + 'links' => [ + [ + 'icon' => 'fa-pencil', + 'text' => E::ts('Settings'), + 'style' => 'default', + 'condition' => ['is_reserved', '=', FALSE], + 'entity' => 'UFGroup', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'path' => 'civicrm/admin/uf/group/field#/?uf_group_id=[id]', + 'icon' => 'fa-list-alt', + 'text' => E::ts('Fields') . ' ([COUNT_UFGroup_UFField_uf_group_id_01_id])', + 'style' => 'default', + 'condition' => [], + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => '', + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + [ + 'text' => '', + 'style' => 'default-outline', + 'size' => 'btn-xs', + 'icon' => 'fa-bars', + 'links' => [ + [ + 'text' => E::ts('Preview'), + 'style' => 'default', + 'condition' => ['COUNT_UFGroup_UFField_uf_group_id_01_id', '>', 0], + 'entity' => 'UFGroup', + 'action' => 'preview', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-eye', + ], + [ + 'path' => 'civicrm/profile/create?gid=[id]&reset=1', + 'icon' => 'fa-external-link', + 'text' => E::ts('Use - Create Mode'), + 'style' => 'default', + 'condition' => [], + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => '_blank', + ], + [ + 'path' => 'civicrm/profile/edit?gid=[id]&reset=1', + 'icon' => 'fa-external-link', + 'text' => E::ts('Use - Edit Mode'), + 'style' => 'default', + 'condition' => [], + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => '_blank', + ], + [ + 'path' => 'civicrm/profile?gid=[id]&reset=1', + 'icon' => 'fa-external-link', + 'text' => E::ts('Use - Listing Mode'), + 'style' => 'default', + 'condition' => [], + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => '_blank', + ], + [ + 'icon' => 'fa-trash', + 'text' => E::ts('Delete'), + 'style' => 'danger', + 'condition' => ['is_reserved', '=', FALSE], + 'entity' => 'UFGroup', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + ], + ], + 'type' => 'menu', + 'alignment' => 'text-right', + 'label' => '', + ], + ], + 'addButton' => [ + 'path' => 'civicrm/admin/uf/group/add?action=add&reset=1', + 'text' => E::ts('Add Profile'), + 'icon' => 'fa-plus', + ], + 'cssRules' => [ + [ + 'disabled', + 'is_active', + '=', + FALSE, + ], + ], + ], + 'acl_bypass' => FALSE, + ], + ], + ], +];