contactcats/managed/searchkit-contacts-by-category.mgd.php
Rich Lott / Artful Robot a4c9251f5e SK/FB work
2025-02-25 17:42:47 +00:00

139 lines
4.1 KiB
PHP

<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_Contacts_by_category',
'entity' => 'SavedSearch',
'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Contacts_by_category',
'label' => E::ts('Contacts by category'),
'api_entity' => 'Contact',
'api_params' => [
'version' => 4,
'select' => [
'id',
'contact_sub_type:label',
'display_name',
'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.label',
],
'orderBy' => [],
'where' => [
[
'contact_type:name',
'=',
'Individual',
],
],
'groupBy' => [],
'join' => [
[
'ContactCategory AS Contact_ContactCategory_contact_id_01',
'INNER',
[
'id',
'=',
'Contact_ContactCategory_contact_id_01.contact_id',
],
[
'Contact_ContactCategory_contact_id_01.id',
'=',
'id',
],
],
[
'ContactCategoryDefinition AS Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01',
'INNER',
[
'Contact_ContactCategory_contact_id_01.category_definition_id',
'=',
'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.id',
],
[
'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.id',
'=',
'Contact_ContactCategory_contact_id_01.category_definition_id',
],
],
],
'having' => [],
],
],
'match' => [
'name',
],
],
],
[
'name' => 'SavedSearch_Contacts_by_category_SearchDisplay_Contacts_by_category_Table_1',
'entity' => 'SearchDisplay',
'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Contacts_by_category_Table_1',
'label' => E::ts('Contacts by category'),
'saved_search_id.name' => 'Contacts_by_category',
'type' => 'table',
'settings' => [
'description' => NULL,
'sort' => [
[
'sort_name',
'ASC',
],
],
'limit' => 50,
'pager' => [],
'placeholder' => 5,
'columns' => [
[
'type' => 'field',
'key' => 'display_name',
'dataType' => 'String',
'label' => E::ts('Name'),
'sortable' => TRUE,
'link' => [
'path' => '',
'entity' => 'Contact',
'action' => 'view',
'join' => '',
'target' => '',
],
'title' => E::ts('View Contact'),
],
[
'type' => 'field',
'key' => 'contact_sub_type:label',
'dataType' => 'String',
'label' => E::ts('Contact Subtype'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.label',
'dataType' => 'String',
'label' => E::ts('Category'),
'sortable' => TRUE,
],
],
'actions' => TRUE,
'classes' => [
'table-striped',
],
'headerCount' => TRUE,
'actions_display_mode' => 'menu',
],
],
'match' => [
'saved_search_id',
'name',
],
],
],
];