3 require_once 'search_kit.civix.php';
6 * Implements hook_civicrm_config().
8 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
10 function search_kit_civicrm_config(&$config) {
11 _search_kit_civix_civicrm_config($config);
12 Civi
::dispatcher()->addListener('hook_civicrm_alterAngular', ['\Civi\Search\AfformSearchMetadataInjector', 'preprocess'], 1000);
16 * Implements hook_civicrm_xmlMenu().
18 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
20 function search_kit_civicrm_xmlMenu(&$files) {
21 _search_kit_civix_civicrm_xmlMenu($files);
25 * Implements hook_civicrm_managed().
27 * Generate a list of entities to create/deactivate/delete when this module
28 * is installed, disabled, uninstalled.
30 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
32 function search_kit_civicrm_managed(&$entities) {
33 _search_kit_civix_civicrm_managed($entities);
37 * Implements hook_civicrm_angularModules().
39 * Generate a list of Angular modules.
41 * Note: This hook only runs in CiviCRM 4.5+. It may
42 * use features only available in v4.6+.
44 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
46 function search_kit_civicrm_angularModules(&$angularModules) {
47 _search_kit_civix_civicrm_angularModules($angularModules);
48 // Fetch all search tasks provided by other modules and add them as crmSearchTasks dependencies
49 $tasks = $dependencies = [];
51 CRM_Utils_Hook
::singleton()->invoke(['tasks'], $tasks,
52 $null, $null, $null, $null, $null, 'civicrm_searchKitTasks'
54 foreach ($tasks as $entityTasks) {
55 foreach ($entityTasks as $task) {
56 if (isset($task['module']) && $task['module'] !== 'crmSearchTasks' &&
57 !in_array($task['module'], $angularModules['crmSearchTasks']['requires'], TRUE)
59 $angularModules['crmSearchTasks']['requires'][] = $task['module'];
66 * Implements hook_civicrm_alterSettingsFolders().
68 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
70 function search_kit_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
71 _search_kit_civix_civicrm_alterSettingsFolders($metaDataFolders);
75 * Implements hook_civicrm_entityTypes().
77 * Declare entity types provided by this module.
79 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
81 function search_kit_civicrm_entityTypes(&$entityTypes) {
82 _search_kit_civix_civicrm_entityTypes($entityTypes);
86 * Implements hook_civicrm_themes().
88 function search_kit_civicrm_themes(&$themes) {
89 _search_kit_civix_civicrm_themes($themes);
93 * Implements hook_civicrm_pre().
95 function search_kit_civicrm_pre($op, $entity, $id, &$params) {
96 // Supply default name/label when creating new SearchDisplay
97 if ($entity === 'SearchDisplay' && $op === 'create') {
98 if (empty($params['label'])) {
99 $params['label'] = $params['name'];
101 elseif (empty($params['name'])) {
102 $params['name'] = \CRM_Utils_String
::munge($params['label']);