DebugSubscriber - Fix compatibility with XDebug 2/3
[civicrm-core.git] / CRM / Grant / Info.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 * This class introduces component to the system and provides all the
14 * information about it. It needs to extend CRM_Core_Component_Info
15 * abstract class.
16 *
17 * @package CRM
ca5cec67 18 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
19 */
20class CRM_Grant_Info extends CRM_Core_Component_Info {
21
e7c15cb6 22 /**
7e8c8317 23 * @var string
e7c15cb6
CW
24 * @inheritDoc
25 */
6a488035
TO
26 protected $keyword = 'grant';
27
e0ef6999 28 /**
e7c15cb6 29 * @inheritDoc
e0ef6999
EM
30 * @return array
31 */
6a488035 32 public function getInfo() {
be2fb01f 33 return [
6a488035
TO
34 'name' => 'CiviGrant',
35 'translatedName' => ts('CiviGrant'),
36 'title' => 'CiviCRM Grant Management Engine',
37 'path' => 'CRM_Grant_',
38 'search' => 1,
39 'showActivitiesInCore' => 1,
be2fb01f 40 ];
6a488035
TO
41 }
42
e0ef6999 43 /**
e7c15cb6 44 * @inheritDoc
e0ef6999 45 * @param bool $getAllUnconditionally
221b21b4
AH
46 * @param bool $descriptions
47 * Whether to return permission descriptions
e0ef6999
EM
48 *
49 * @return array
50 */
221b21b4 51 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
be2fb01f
CW
52 $permissions = [
53 'access CiviGrant' => [
221b21b4
AH
54 ts('access CiviGrant'),
55 ts('View all grants'),
be2fb01f
CW
56 ],
57 'edit grants' => [
221b21b4
AH
58 ts('edit grants'),
59 ts('Create and update grants'),
be2fb01f
CW
60 ],
61 'delete in CiviGrant' => [
221b21b4
AH
62 ts('delete in CiviGrant'),
63 ts('Delete grants'),
be2fb01f
CW
64 ],
65 ];
221b21b4
AH
66
67 if (!$descriptions) {
68 foreach ($permissions as $name => $attr) {
69 $permissions[$name] = array_shift($attr);
70 }
71 }
72
73 return $permissions;
6a488035
TO
74 }
75
e0ef6999 76 /**
e7c15cb6 77 * @inheritDoc
e0ef6999
EM
78 * @return null
79 */
6a488035
TO
80 public function getUserDashboardElement() {
81 // no dashboard element for this component
82 return NULL;
83 }
84
e0ef6999 85 /**
e7c15cb6 86 * @inheritDoc
e0ef6999
EM
87 * @return null
88 */
6a488035
TO
89 public function getUserDashboardObject() {
90 // no dashboard element for this component
91 return NULL;
92 }
93
e0ef6999 94 /**
e7c15cb6 95 * @inheritDoc
e0ef6999
EM
96 * @return array
97 */
6a488035 98 public function registerTab() {
be2fb01f 99 return [
353ffa53 100 'title' => ts('Grants'),
6a488035 101 'url' => 'grant',
42e86792 102 'weight' => 60,
be2fb01f 103 ];
6a488035
TO
104 }
105
b04115b4
CW
106 /**
107 * @inheritDoc
108 * @return string
109 */
110 public function getIcon() {
111 return 'crm-i fa-money';
112 }
113
e0ef6999 114 /**
e7c15cb6 115 * @inheritDoc
e0ef6999
EM
116 * @return array
117 */
6a488035 118 public function registerAdvancedSearchPane() {
be2fb01f 119 return [
353ffa53 120 'title' => ts('Grants'),
6a488035 121 'weight' => 50,
be2fb01f 122 ];
6a488035
TO
123 }
124
e0ef6999 125 /**
e7c15cb6 126 * @inheritDoc
e0ef6999
EM
127 * @return null
128 */
6a488035
TO
129 public function getActivityTypes() {
130 return NULL;
131 }
132
e0ef6999 133 /**
fe482240 134 * add shortcut to Create New.
e0ef6999
EM
135 * @param $shortCuts
136 */
6a488035
TO
137 public function creatNewShortcut(&$shortCuts) {
138 if (CRM_Core_Permission::check('access CiviGrant') &&
139 CRM_Core_Permission::check('edit grants')
140 ) {
be2fb01f
CW
141 $shortCuts = array_merge($shortCuts, [
142 [
353ffa53
TO
143 'path' => 'civicrm/grant/add',
144 'query' => "reset=1&action=add&context=standalone",
145 'ref' => 'new-grant',
146 'title' => ts('Grant'),
be2fb01f
CW
147 ],
148 ]);
6a488035
TO
149 }
150 }
96025800 151
6a488035 152}