Merge pull request #20283 from colemanw/afformEnabledEntities
[civicrm-core.git] / ext / search_kit / search_kit.php
1 <?php
2
3 require_once 'search_kit.civix.php';
4
5 /**
6 * Implements hook_civicrm_config().
7 *
8 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
9 */
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);
13 }
14
15 /**
16 * Implements hook_civicrm_xmlMenu().
17 *
18 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
19 */
20 function search_kit_civicrm_xmlMenu(&$files) {
21 _search_kit_civix_civicrm_xmlMenu($files);
22 }
23
24 /**
25 * Implements hook_civicrm_managed().
26 *
27 * Generate a list of entities to create/deactivate/delete when this module
28 * is installed, disabled, uninstalled.
29 *
30 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
31 */
32 function search_kit_civicrm_managed(&$entities) {
33 _search_kit_civix_civicrm_managed($entities);
34 }
35
36 /**
37 * Implements hook_civicrm_angularModules().
38 *
39 * Generate a list of Angular modules.
40 *
41 * Note: This hook only runs in CiviCRM 4.5+. It may
42 * use features only available in v4.6+.
43 *
44 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
45 */
46 function search_kit_civicrm_angularModules(&$angularModules) {
47 _search_kit_civix_civicrm_angularModules($angularModules);
48 }
49
50 /**
51 * Implements hook_civicrm_alterSettingsFolders().
52 *
53 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
54 */
55 function search_kit_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
56 _search_kit_civix_civicrm_alterSettingsFolders($metaDataFolders);
57 }
58
59 /**
60 * Implements hook_civicrm_entityTypes().
61 *
62 * Declare entity types provided by this module.
63 *
64 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
65 */
66 function search_kit_civicrm_entityTypes(&$entityTypes) {
67 _search_kit_civix_civicrm_entityTypes($entityTypes);
68 }
69
70 /**
71 * Implements hook_civicrm_themes().
72 */
73 function search_kit_civicrm_themes(&$themes) {
74 _search_kit_civix_civicrm_themes($themes);
75 }
76
77 /**
78 * Implements hook_civicrm_pre().
79 */
80 function search_kit_civicrm_pre($op, $entity, $id, &$params) {
81 // Supply default name/label when creating new SearchDisplay
82 if ($entity === 'SearchDisplay' && $op === 'create') {
83 if (empty($params['label'])) {
84 $params['label'] = $params['name'];
85 }
86 elseif (empty($params['name'])) {
87 $params['name'] = \CRM_Utils_String::munge($params['label']);
88 }
89 }
90 }