Merge pull request #22613 from eileenmcnaughton/notice
[civicrm-core.git] / ext / civigrant / civigrant.php
1 <?php
2
3 require_once 'civigrant.civix.php';
4 use CRM_Grant_ExtensionUtil as E;
5
6 /**
7 * Implements hook_civicrm_config().
8 *
9 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
10 */
11 function civigrant_civicrm_config(&$config) {
12 _civigrant_civix_civicrm_config($config);
13 }
14
15 /**
16 * Implements hook_civicrm_alterSettingsFolders().
17 *
18 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
19 */
20 function civigrant_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
21 _civigrant_civix_civicrm_alterSettingsFolders($metaDataFolders);
22 }
23
24 /**
25 * Implements hook_civicrm_entityTypes().
26 *
27 * Declare entity types provided by this module.
28 *
29 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
30 */
31 function civigrant_civicrm_entityTypes(&$entityTypes) {
32 _civigrant_civix_civicrm_entityTypes($entityTypes);
33 }
34
35 /**
36 * Implements hook_civicrm_links().
37 *
38 * Add shortcut link to create new grant.
39 */
40 function civigrant_civicrm_links($context, $name, $id, &$links) {
41 if ($context === 'create.new.shortcuts' && CRM_Core_Permission::check(['access CiviGrant', 'edit grants'])) {
42 $links[] = [
43 'path' => 'civicrm/grant/add',
44 'query' => "reset=1&action=add&context=standalone",
45 'ref' => 'new-grant',
46 'title' => ts('Grant'),
47 ];
48 }
49 }
50
51 /**
52 * Implements hook_civicrm_permission().
53 *
54 * Define CiviGrant permissions.
55 */
56 function civigrant_civicrm_permission(&$permissions) {
57 $permissions['access CiviGrant'] = [
58 E::ts('access CiviGrant'),
59 E::ts('View all grants'),
60 ];
61 $permissions['edit grants'] = [
62 E::ts('edit grants'),
63 E::ts('Create and update grants'),
64 ];
65 $permissions['delete in CiviGrant'] = [
66 E::ts('delete in CiviGrant'),
67 E::ts('Delete grants'),
68 ];
69 }
70
71 /**
72 * Implements hook_civicrm_queryObjects().
73 *
74 * Adds query object for legacy screens like advanced search, search builder, etc.
75 */
76 function civigrant_civicrm_queryObjects(&$queryObjects, $type) {
77 if ($type == 'Contact') {
78 $queryObjects[] = new CRM_Grant_BAO_Query();
79 }
80 elseif ($type == 'Report') {
81 // Do we need to do something here?
82 }
83 }