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_Contribute_Info
extends CRM_Core_Component_Info
{
27 protected $keyword = 'contribute';
31 * Provides base information about the component.
32 * Needs to be implemented in component's information
36 * collection of required component settings
42 public function getInfo() {
44 'name' => 'CiviContribute',
45 'translatedName' => ts('CiviContribute'),
46 'title' => ts('CiviCRM Contribution Engine'),
48 'showActivitiesInCore' => 1,
54 * Provides permissions that are used by component.
55 * Needs to be implemented in component's information
58 * NOTE: if using conditionally permission return,
59 * implementation of $getAllUnconditionally is required.
61 * @param bool $getAllUnconditionally
62 * @param bool $descriptions
63 * Whether to return permission descriptions
66 * collection of permissions, null if none
68 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
70 'access CiviContribute' => [
71 ts('access CiviContribute'),
72 ts('Record backend contributions (with edit contributions) and view all contributions (for visible contacts)'),
74 'edit contributions' => [
75 ts('edit contributions'),
76 ts('Record and update contributions'),
78 'make online contributions' => [
79 ts('make online contributions'),
81 'delete in CiviContribute' => [
82 ts('delete in CiviContribute'),
83 ts('Delete contributions'),
88 foreach ($permissions as $name => $attr) {
89 $permissions[$name] = array_shift($attr);
97 * Provides permissions that are unwise for Anonymous Roles to have.
100 * list of permissions
101 * @see CRM_Component_Info::getPermissions
107 public function getAnonymousPermissionWarnings() {
109 'access CiviContribute',
115 * Provides information about user dashboard element
116 * offered by this component.
119 * collection of required dashboard settings,
120 * null if no element offered
126 public function getUserDashboardElement() {
128 'name' => ts('Contributions'),
129 'title' => ts('Your Contribution(s)'),
130 'perm' => ['make online contributions'],
137 * Provides information about user dashboard element
138 * offered by this component.
141 * collection of required dashboard settings,
142 * null if no element offered
148 public function registerTab() {
150 'title' => ts('Contributions'),
151 'url' => 'contribution',
160 public function getIcon() {
161 return 'crm-i fa-credit-card';
166 * Provides information about advanced search pane
167 * offered by this component.
170 * collection of required pane settings,
171 * null if no element offered
177 public function registerAdvancedSearchPane() {
179 'title' => ts('Contributions'),
186 * Provides potential activity types that this
187 * component might want to register in activity history.
188 * Needs to be implemented in component's information
192 * collection of activity types
198 public function getActivityTypes() {
203 * add shortcut to Create New.
207 public function creatNewShortcut(&$shortCuts, $newCredit) {
208 if (CRM_Core_Permission
::check('access CiviContribute') &&
209 CRM_Core_Permission
::check('edit contributions')
212 'path' => 'civicrm/contribute/add',
213 'query' => "reset=1&action=add&context=standalone",
214 'ref' => 'new-contribution',
215 'title' => ts('Contribution'),
218 $title = ts('Contribution') . '<br /> (' . ts('credit card') . ')';
219 $shortCut[0]['shortCuts'][] = [
220 'path' => 'civicrm/contribute/add',
221 'query' => "reset=1&action=add&context=standalone&mode=live",
222 'ref' => 'new-contribution-cc',
226 $shortCuts = array_merge($shortCuts, $shortCut);