Skip to content

Commit

Permalink
CIVIPLMMSR-116: Fix upgrading sites with afform and searchkit enabled
Browse files Browse the repository at this point in the history
Included in CiviCRM version: 5.53.0

PRs:

- civicrm#23895
- civicrm#23896
  • Loading branch information
omarabuhussein committed Nov 7, 2023
1 parent 6aa4783 commit 302bf69
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 54 deletions.
140 changes: 109 additions & 31 deletions ext/afform/core/managed/AfformType.mgd.php
Original file line number Diff line number Diff line change
@@ -1,66 +1,144 @@
<?php
// Adds option group for Afform.type

$mgd = [
use CRM_Afform_ExtensionUtil as E;

// Adds option group for Afform.type
return [
[
'name' => 'AfformType',
'entity' => 'OptionGroup',
'update' => 'always',
'cleanup' => 'always',
'params' => [
'name' => 'afform_type',
'title' => 'Afform Type',
'option_value_fields' => ['name', 'label', 'icon', 'description'],
'version' => 4,
'values' => [
'name' => 'afform_type',
'title' => E::ts('Afform Type'),
'description' => NULL,
'data_type' => NULL,
'is_reserved' => TRUE,
'is_active' => TRUE,
'is_locked' => FALSE,
'option_value_fields' => [
'name',
'label',
'icon',
'description',
],
],
'match' => ['name'],
],
],
[
'name' => 'AfformType:form',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'afform_type',
'name' => 'form',
'value' => 'form',
'label' => 'Submission Form',
'weight' => 0,
'icon' => 'fa-list-alt',
'version' => 4,
'values' => [
'option_group_id.name' => 'afform_type',
'name' => 'form',
'value' => 'form',
'label' => E::ts('Submission Form'),
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
'icon' => 'fa-list-alt',
'color' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
[
'name' => 'AfformType:search',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'afform_type',
'name' => 'search',
'value' => 'search',
'label' => 'Search Form',
'weight' => 10,
'icon' => 'fa-search',
'version' => 4,
'values' => [
'option_group_id.name' => 'afform_type',
'name' => 'search',
'value' => 'search',
'label' => E::ts('Search Form'),
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
'icon' => 'fa-search',
'color' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
[
'name' => 'AfformType:block',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'afform_type',
'name' => 'block',
'value' => 'block',
'label' => 'Field Block',
'weight' => 20,
'icon' => 'fa-th-large',
'version' => 4,
'values' => [
'option_group_id.name' => 'afform_type',
'name' => 'block',
'value' => 'block',
'label' => E::ts('Field Block'),
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
'icon' => 'fa-th-large',
'color' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
[
'name' => 'AfformType:system',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'afform_type',
'name' => 'system',
'value' => 'system',
'label' => 'System Form',
'weight' => 50,
'icon' => 'fa-lock',
'version' => 4,
'values' => [
'option_group_id.name' => 'afform_type',
'name' => 'system',
'value' => 'system',
'label' => E::ts('System Form'),
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
'icon' => 'fa-lock',
'color' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
];

return $mgd;
101 changes: 83 additions & 18 deletions ext/search_kit/managed/SearchDisplayType.mgd.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,107 @@
'update' => 'always',
'cleanup' => 'always',
'params' => [
'name' => 'search_display_type',
'title' => 'Search Display Type',
'option_value_fields' => ['name', 'label', 'icon', 'description'],
'version' => 4,
'values' => [
'name' => 'search_display_type',
'title' => 'Search Display Type',
'description' => NULL,
'data_type' => NULL,
'is_reserved' => TRUE,
'is_active' => TRUE,
'is_locked' => FALSE,
'option_value_fields' => [
'name',
'label',
'icon',
'description',
],
],
'match' => ['name'],
],
],
[
'name' => 'SearchDisplayType:table',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'search_display_type',
'value' => 'table',
'name' => 'crm-search-display-table',
'label' => 'Table',
'icon' => 'fa-table',
'version' => 4,
'values' => [
'option_group_id.name' => 'search_display_type',
'value' => 'table',
'name' => 'crm-search-display-table',
'label' => 'Table',
'icon' => 'fa-table',
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'color' => NULL,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
[
'name' => 'SearchDisplayType:list',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'search_display_type',
'value' => 'list',
'name' => 'crm-search-display-list',
'label' => 'List',
'icon' => 'fa-list',
'version' => 4,
'values' => [
'option_group_id.name' => 'search_display_type',
'value' => 'list',
'name' => 'crm-search-display-list',
'label' => 'List',
'icon' => 'fa-list',
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'color' => NULL,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
[
'name' => 'SearchDisplayType:grid',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'search_display_type',
'value' => 'grid',
'name' => 'crm-search-display-grid',
'label' => 'Grid',
'icon' => 'fa-th',
'version' => 4,
'values' => [
'option_group_id.name' => 'search_display_type',
'value' => 'grid',
'name' => 'crm-search-display-grid',
'label' => 'Grid',
'icon' => 'fa-th',
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'color' => NULL,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
];
30 changes: 25 additions & 5 deletions ext/search_kit/managed/TagUsedFor.mgd.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
<?php
// Adds option group for SearchDisplay.type

use CRM_Search_ExtensionUtil as E;

// Adds option value to `tag_used_for`, allowing Saved Searches to be tagged
return [
[
'name' => 'SavedSearch:tag_used_for',
'entity' => 'OptionValue',
'cleanup' => 'always',
'update' => 'always',
'params' => [
'option_group_id' => 'tag_used_for',
'value' => 'civicrm_saved_search',
'name' => 'SavedSearch',
'label' => ts('Saved Searches'),
'version' => 4,
'values' => [
'option_group_id.name' => 'tag_used_for',
'value' => 'civicrm_saved_search',
'name' => 'SavedSearch',
'label' => E::ts('Saved Searches'),
'grouping' => NULL,
'filter' => 0,
'is_default' => FALSE,
'description' => NULL,
'is_optgroup' => FALSE,
'is_reserved' => FALSE,
'is_active' => TRUE,
'component_id' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
'icon' => NULL,
'color' => NULL,
],
'match' => ['option_group_id', 'name'],
],
],
];

0 comments on commit 302bf69

Please sign in to comment.