3 require_once 'civigrant.civix.php';
4 use CRM_Grant_ExtensionUtil
as E
;
7 * Implements hook_civicrm_config().
9 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
11 function civigrant_civicrm_config(&$config) {
12 _civigrant_civix_civicrm_config($config);
16 * Implements hook_civicrm_alterSettingsFolders().
18 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
20 function civigrant_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
21 _civigrant_civix_civicrm_alterSettingsFolders($metaDataFolders);
25 * Implements hook_civicrm_entityTypes().
27 * Declare entity types provided by this module.
29 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
31 function civigrant_civicrm_entityTypes(&$entityTypes) {
32 _civigrant_civix_civicrm_entityTypes($entityTypes);
36 * Implements hook_civicrm_links().
38 * Add shortcut link to create new grant.
40 function civigrant_civicrm_links($context, $name, $id, &$links) {
41 if ($context === 'create.new.shortcuts' && CRM_Core_Permission
::check(['access CiviGrant', 'edit grants'])) {
43 'path' => 'civicrm/grant/add',
44 'query' => "reset=1&action=add&context=standalone",
46 'title' => ts('Grant'),
52 * Implements hook_civicrm_permission().
54 * Define CiviGrant permissions.
56 function civigrant_civicrm_permission(&$permissions) {
57 $permissions['access CiviGrant'] = [
58 E
::ts('access CiviGrant'),
59 E
::ts('View all grants'),
61 $permissions['edit grants'] = [
63 E
::ts('Create and update grants'),
65 $permissions['delete in CiviGrant'] = [
66 E
::ts('delete in CiviGrant'),
67 E
::ts('Delete grants'),
72 * Implements hook_civicrm_alterAPIPermissions().
74 * Set CiviGrant permissions for APIv3.
76 function civigrant_civicrm_alterAPIPermissions($entity, $action, &$params, &$permissions) {
77 $permissions['grant'] = [
82 'delete in CiviGrant',
94 * Implements hook_civicrm_queryObjects().
96 * Adds query object for legacy screens like advanced search, search builder, etc.
98 function civigrant_civicrm_queryObjects(&$queryObjects, $type) {
99 if ($type == 'Contact') {
100 $queryObjects[] = new CRM_Grant_BAO_Query();
102 elseif ($type == 'Report') {
103 // Do we need to do something here?