3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 |
9 +--------------------------------------------------------------------+
13 * This class introduces component to the system and provides all the
14 * information about it. It needs to extend CRM_Core_Component_Info
18 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 class CRM_Pledge_Info
extends CRM_Core_Component_Info
{
26 protected $keyword = 'pledge';
29 * Provides base information about the component.
30 * Needs to be implemented in component's information
34 * collection of required component settings
36 public function getInfo() {
38 'name' => 'CiviPledge',
39 'translatedName' => ts('CiviPledge'),
40 'title' => ts('CiviCRM Pledge Engine'),
42 'showActivitiesInCore' => 1,
48 * Provides permissions that are used by component.
49 * Needs to be implemented in component's information
52 * NOTE: if using conditionally permission return,
53 * implementation of $getAllUnconditionally is required.
55 * @param bool $getAllUnconditionally
56 * @param bool $descriptions
57 * Whether to return permission descriptions
60 * collection of permissions, null if none
62 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
64 'access CiviPledge' => [
65 ts('access CiviPledge'),
70 ts('Create and update pledges'),
72 'delete in CiviPledge' => [
73 ts('delete in CiviPledge'),
79 foreach ($permissions as $name => $attr) {
80 $permissions[$name] = array_shift($attr);
89 * Provides information about user dashboard element
90 * offered by this component.
93 * collection of required dashboard settings,
94 * null if no element offered
96 public function getUserDashboardElement() {
98 'name' => ts('Pledges'),
99 'title' => ts('Your Pledge(s)'),
100 // we need to check this permission since you can click on contribution page link for making payment
101 'perm' => ['make online contributions'],
108 * Provides information about user dashboard element
109 * offered by this component.
112 * collection of required dashboard settings,
113 * null if no element offered
115 public function registerTab() {
117 'title' => ts('Pledges'),
127 public function getIcon() {
128 return 'crm-i fa-paper-plane';
133 * Provides information about advanced search pane
134 * offered by this component.
137 * collection of required pane settings,
138 * null if no element offered
140 public function registerAdvancedSearchPane() {
142 'title' => ts('Pledges'),
149 * Provides potential activity types that this
150 * component might want to register in activity history.
151 * Needs to be implemented in component's information
155 * collection of activity types
157 public function getActivityTypes() {
162 * add shortcut to Create New.
165 public function creatNewShortcut(&$shortCuts) {
166 if (CRM_Core_Permission
::check('access CiviPledge') &&
167 CRM_Core_Permission
::check('edit pledges')
169 $shortCuts = array_merge($shortCuts, [
171 'path' => 'civicrm/pledge/add',
172 'query' => 'reset=1&action=add&context=standalone',
173 'ref' => 'new-pledge',
174 'title' => ts('Pledge'),