Migrate LabelFormat from SearchUI to AdminUI
authorAidan Saunders <aidan.saunders@squiffle.uk>
Wed, 6 Dec 2023 22:46:15 +0000 (22:46 +0000)
committerAidan Saunders <aidan.saunders@squiffle.uk>
Thu, 7 Dec 2023 18:17:58 +0000 (18:17 +0000)
ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.html [moved from ext/civicrm_search_ui/ang/afsearchLabelFormat.aff.html with 100% similarity]
ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.php [moved from ext/civicrm_search_ui/ang/afsearchLabelFormat.aff.php with 69% similarity]
ext/civicrm_admin_ui/managed/SavedSearch_label_format.mgd.php [moved from ext/civicrm_search_ui/managed/SavedSearch_label_format.mgd.php with 85% similarity]

similarity index 69%
rename from ext/civicrm_search_ui/ang/afsearchLabelFormat.aff.php
rename to ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.php
index 88742dfb1b29bd3df89470f6892bfa182dca1150..d0d3f0d4981acf80f51b5912a0071993d7e3afd2 100644 (file)
@@ -1,12 +1,12 @@
 <?php
-use CRM_CivicrmSearchUi_ExtensionUtil as E;
+use CRM_CivicrmAdminUi_ExtensionUtil as E;
 
 return [
   'type' => 'search',
   'title' => E::ts('Label Formats'),
   'description' => E::ts('Label Formats'),
   'icon' => 'fa-list-alt',
-  'server_route' => 'civicrm/searchkit_ui/admin/labelFormats',
+  'server_route' => 'civicrm/admin/labelFormats',
   'permission' => [
     'administer CiviCRM',
   ],
similarity index 85%
rename from ext/civicrm_search_ui/managed/SavedSearch_label_format.mgd.php
rename to ext/civicrm_admin_ui/managed/SavedSearch_label_format.mgd.php
index 0a225004fbf95fea5d92898828bfad38e6649ad3..406f8750c5c17a468f526cda05f32782beb747c1 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-use CRM_CivicrmSearchUi_ExtensionUtil as E;
+use CRM_CivicrmAdminUi_ExtensionUtil as E;
 
 return [
   [
@@ -11,7 +11,7 @@ return [
       'version' => 4,
       'values' => [
         'name' => 'label_format',
-        'label' => E::ts('label format'),
+        'label' => E::ts('Label Format'),
         'api_entity' => 'OptionGroup',
         'api_params' => [
           'version' => 4,
@@ -19,7 +19,7 @@ return [
             'OptionGroup_OptionValue_option_group_id_01.label',
             'title',
             'description',
-            'is_reserved',
+            'OptionGroup_OptionValue_option_group_id_01.is_reserved',
             'OptionGroup_OptionValue_option_group_id_01.grouping',
             'OptionGroup_OptionValue_option_group_id_01.is_default',
           ],
@@ -63,7 +63,7 @@ return [
       'version' => 4,
       'values' => [
         'name' => 'label_format_Table_1',
-        'label' => E::ts('label format Table 1'),
+        'label' => E::ts('Label Format Table 1'),
         'saved_search_id.name' => 'label_format',
         'type' => 'table',
         'settings' => [
@@ -119,7 +119,7 @@ return [
             ],
             [
               'type' => 'field',
-              'key' => 'is_reserved',
+              'key' => 'OptionGroup_OptionValue_option_group_id_01.is_reserved',
               'dataType' => 'Boolean',
               'label' => E::ts('Reserved'),
               'sortable' => TRUE,
@@ -154,6 +154,22 @@ return [
                   'join' => '',
                   'target' => 'crm-popup',
                 ],
+                [
+                  'entity' => 'OptionValue',
+                  'action' => 'delete',
+                  'join' => 'OptionGroup_OptionValue_option_group_id_01',
+                  'target' => 'crm-popup',
+                  'icon' => 'fa-trash',
+                  'text' => E::ts('Delete'),
+                  'style' => 'danger',
+                  'path' => '',
+                  'task' => '',
+                  'condition' => [
+                    'OptionGroup_OptionValue_option_group_id_01.is_reserved',
+                    '=',
+                    FALSE,
+                  ],
+                ],
               ],
               'type' => 'menu',
               'alignment' => 'text-right',