Merge pull request #22464 from colemanw/extRequirementCheck
[civicrm-core.git] / ext / search_kit / search_kit.php
index 846b2b61b632629b8ddf76599b8a490c8c1f1d54..24a0e76058af4593fda561d6b738a9b39ddce263 100644 (file)
@@ -38,27 +38,6 @@ function search_kit_civicrm_alterApiRoutePermissions(&$permissions, $entity, $ac
   }
 }
 
-/**
- * Implements hook_civicrm_xmlMenu().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
- */
-function search_kit_civicrm_xmlMenu(&$files) {
-  _search_kit_civix_civicrm_xmlMenu($files);
-}
-
-/**
- * Implements hook_civicrm_managed().
- *
- * Generate a list of entities to create/deactivate/delete when this module
- * is installed, disabled, uninstalled.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
- */
-function search_kit_civicrm_managed(&$entities) {
-  _search_kit_civix_civicrm_managed($entities);
-}
-
 /**
  * Implements hook_civicrm_angularModules().
  *
@@ -70,7 +49,6 @@ function search_kit_civicrm_managed(&$entities) {
  * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
  */
 function search_kit_civicrm_angularModules(&$angularModules) {
-  _search_kit_civix_civicrm_angularModules($angularModules);
   // Fetch all search tasks provided by extensions and add their Angular modules as crmSearchTasks dependencies
   $tasks = [];
   $null = NULL;
@@ -90,15 +68,6 @@ function search_kit_civicrm_angularModules(&$angularModules) {
   }
 }
 
-/**
- * Implements hook_civicrm_alterSettingsFolders().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
- */
-function search_kit_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
-  _search_kit_civix_civicrm_alterSettingsFolders($metaDataFolders);
-}
-
 /**
  * Implements hook_civicrm_entityTypes().
  *
@@ -110,13 +79,6 @@ function search_kit_civicrm_entityTypes(&$entityTypes) {
   _search_kit_civix_civicrm_entityTypes($entityTypes);
 }
 
-/**
- * Implements hook_civicrm_themes().
- */
-function search_kit_civicrm_themes(&$themes) {
-  _search_kit_civix_civicrm_themes($themes);
-}
-
 /**
  * Implements hook_civicrm_pre().
  */
@@ -130,4 +92,12 @@ function search_kit_civicrm_pre($op, $entity, $id, &$params) {
       $params['name'] = \CRM_Utils_String::munge($params['label']);
     }
   }
+  // When deleting a saved search, also delete the displays
+  // This would happen anyway in sql because of the ON DELETE CASCADE foreign key,
+  // But this ensures that pre and post hooks are called
+  if ($entity === 'SavedSearch' && $op === 'delete') {
+    \Civi\Api4\SearchDisplay::delete(FALSE)
+      ->addWhere('saved_search_id', '=', $id)
+      ->execute();
+  }
 }