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'])) {
45 'title' => ts('Grant'),
46 'url' => CRM_Utils_System
::url('civicrm/grant/add', 'reset=1&action=add&context=standalone'),
52 * Implements hook_civicrm_summaryActions().
54 * Add contact summary link to create new grant.
56 function civigrant_civicrm_summaryActions(&$menu, $cid) {
58 'title' => ts('Add Grant'),
62 'tab' => 'afsearchGrants',
63 'href' => CRM_Utils_System
::url('civicrm/contact/view/grant',
64 'reset=1&action=add&context=grant'
66 'permissions' => ['edit grants'],
71 * Implements hook_civicrm_permission().
73 * Define CiviGrant permissions.
75 function civigrant_civicrm_permission(&$permissions) {
76 $permissions['access CiviGrant'] = [
77 E
::ts('access CiviGrant'),
78 E
::ts('View all grants'),
80 $permissions['edit grants'] = [
82 E
::ts('Create and update grants'),
84 $permissions['delete in CiviGrant'] = [
85 E
::ts('delete in CiviGrant'),
86 E
::ts('Delete grants'),
91 * Implements hook_civicrm_alterAPIPermissions().
93 * Set CiviGrant permissions for APIv3.
95 function civigrant_civicrm_alterAPIPermissions($entity, $action, &$params, &$permissions) {
96 $permissions['grant'] = [
101 'delete in CiviGrant',
113 * Implements hook_civicrm_queryObjects().
115 * Adds query object for legacy screens like advanced search, search builder, etc.
117 function civigrant_civicrm_queryObjects(&$queryObjects, $type) {
118 if ($type == 'Contact') {
119 $queryObjects[] = new CRM_Grant_BAO_Query();
121 elseif ($type == 'Report') {
122 // Do we need to do something here?