Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06b69b18 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CiviCRM_Hook | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id: $ |
33 | * | |
34 | */ | |
35 | ||
36 | abstract class CRM_Utils_Hook { | |
37 | ||
38 | // Allowed values for dashboard hook content placement | |
39 | // Default - place content below activity list | |
40 | CONST DASHBOARD_BELOW = 1; | |
41 | // Place content above activity list | |
42 | CONST DASHBOARD_ABOVE = 2; | |
43 | // Don't display activity list at all | |
44 | CONST DASHBOARD_REPLACE = 3; | |
45 | ||
46 | // by default - place content below existing content | |
47 | CONST SUMMARY_BELOW = 1; | |
48 | // pace hook content above | |
49 | CONST SUMMARY_ABOVE = 2; | |
50 | // create your own summarys | |
51 | CONST SUMMARY_REPLACE = 3; | |
52 | ||
53 | static $_nullObject = NULL; | |
54 | ||
55 | /** | |
56 | * We only need one instance of this object. So we use the singleton | |
57 | * pattern and cache the instance in this variable | |
58 | * | |
59 | * @var object | |
60 | * @static | |
61 | */ | |
62 | static private $_singleton = NULL; | |
63 | ||
64 | /** | |
65 | * @var bool | |
66 | */ | |
67 | private $commonIncluded = FALSE; | |
68 | ||
69 | /** | |
70 | * @var array(string) | |
71 | */ | |
72 | private $commonCiviModules = array(); | |
73 | ||
74 | /** | |
75 | * Constructor and getter for the singleton instance | |
76 | * | |
72536736 AH |
77 | * @param bool $fresh |
78 | * | |
79 | * @return self | |
80 | * An instance of $config->userHookClass | |
6a488035 TO |
81 | */ |
82 | static function singleton($fresh = FALSE) { | |
83 | if (self::$_singleton == NULL || $fresh) { | |
84 | $config = CRM_Core_Config::singleton(); | |
85 | $class = $config->userHookClass; | |
86 | require_once (str_replace('_', DIRECTORY_SEPARATOR, $config->userHookClass) . '.php'); | |
87 | self::$_singleton = new $class(); | |
88 | } | |
89 | return self::$_singleton; | |
90 | } | |
91 | ||
72536736 | 92 | /** |
f0a7a0c9 EM |
93 | *Invoke hooks |
94 | * | |
95 | * @param int $numParams Number of parameters to pass to the hook | |
96 | * @param mixed $arg1 parameter to be passed to the hook | |
97 | * @param mixed $arg2 parameter to be passed to the hook | |
98 | * @param mixed $arg3 parameter to be passed to the hook | |
99 | * @param mixed $arg4 parameter to be passed to the hook | |
100 | * @param mixed $arg5 parameter to be passed to the hook | |
101 | * @param mixed $arg6 parameter to be passed to the hook | |
102 | * @param string $fnSuffix function suffix, this is effectively the hook name | |
72536736 AH |
103 | * |
104 | * @return mixed | |
105 | */ | |
6a488035 | 106 | abstract function invoke($numParams, |
87dab4a4 | 107 | &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, |
6a488035 TO |
108 | $fnSuffix |
109 | ); | |
110 | ||
6a488035 | 111 | function commonInvoke($numParams, |
87dab4a4 | 112 | &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, |
6a488035 TO |
113 | $fnSuffix, $fnPrefix |
114 | ) { | |
115 | ||
116 | $this->commonBuildModuleList($fnPrefix); | |
4636d4fd | 117 | |
6a488035 | 118 | return $this->runHooks($this->commonCiviModules, $fnSuffix, |
87dab4a4 | 119 | $numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6 |
6a488035 TO |
120 | ); |
121 | } | |
122 | ||
123 | /** | |
124 | * Build the list of modules to be processed for hooks. | |
72536736 AH |
125 | * |
126 | * @param string $fnPrefix | |
6a488035 TO |
127 | */ |
128 | function commonBuildModuleList($fnPrefix) { | |
129 | if (!$this->commonIncluded) { | |
130 | // include external file | |
131 | $this->commonIncluded = TRUE; | |
132 | ||
133 | $config = CRM_Core_Config::singleton(); | |
134 | if (!empty($config->customPHPPathDir) && | |
135 | file_exists("{$config->customPHPPathDir}/civicrmHooks.php") | |
136 | ) { | |
137 | @include_once ("civicrmHooks.php"); | |
138 | } | |
139 | ||
140 | if (!empty($fnPrefix)) { | |
141 | $this->commonCiviModules[$fnPrefix] = $fnPrefix; | |
142 | } | |
143 | ||
144 | $this->requireCiviModules($this->commonCiviModules); | |
145 | } | |
146 | } | |
147 | ||
72536736 AH |
148 | /** |
149 | * @param $civiModules | |
150 | * @param $fnSuffix | |
151 | * @param $numParams | |
152 | * @param $arg1 | |
153 | * @param $arg2 | |
154 | * @param $arg3 | |
155 | * @param $arg4 | |
156 | * @param $arg5 | |
157 | * @param $arg6 | |
158 | * | |
159 | * @return array|bool | |
160 | */ | |
3ac9ab1c | 161 | function runHooks($civiModules, $fnSuffix, $numParams, |
87dab4a4 | 162 | &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6 |
6a488035 | 163 | ) { |
3ac9ab1c TO |
164 | // $civiModules is *not* passed by reference because runHooks |
165 | // must be reentrant. PHP is finicky about running | |
166 | // multiple loops over the same variable. The circumstances | |
167 | // to reproduce the issue are pretty intricate. | |
6a488035 TO |
168 | $result = $fResult = array(); |
169 | ||
4636d4fd DL |
170 | if ($civiModules !== NULL) { |
171 | foreach ($civiModules as $module) { | |
172 | $fnName = "{$module}_{$fnSuffix}"; | |
173 | if (function_exists($fnName)) { | |
174 | switch ($numParams) { | |
175 | case 0: | |
176 | $fResult = $fnName(); | |
177 | break; | |
178 | ||
179 | case 1: | |
180 | $fResult = $fnName($arg1); | |
181 | break; | |
182 | ||
183 | case 2: | |
184 | $fResult = $fnName($arg1, $arg2); | |
185 | break; | |
186 | ||
187 | case 3: | |
188 | $fResult = $fnName($arg1, $arg2, $arg3); | |
189 | break; | |
190 | ||
191 | case 4: | |
192 | $fResult = $fnName($arg1, $arg2, $arg3, $arg4); | |
193 | break; | |
194 | ||
195 | case 5: | |
196 | $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5); | |
197 | break; | |
198 | ||
87dab4a4 AH |
199 | case 6: |
200 | $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6); | |
201 | break; | |
f0a7a0c9 | 202 | |
4636d4fd DL |
203 | default: |
204 | CRM_Core_Error::fatal(ts('Invalid hook invocation')); | |
205 | break; | |
206 | } | |
6a488035 | 207 | } |
6a488035 | 208 | |
4636d4fd | 209 | if (!empty($fResult) && |
6a488035 | 210 | is_array($fResult)) { |
4636d4fd DL |
211 | $result = array_merge($result, $fResult); |
212 | } | |
6a488035 TO |
213 | } |
214 | } | |
215 | ||
216 | return empty($result) ? TRUE : $result; | |
217 | } | |
218 | ||
219 | function requireCiviModules(&$moduleList) { | |
220 | $civiModules = CRM_Core_PseudoConstant::getModuleExtensions(); | |
221 | foreach ($civiModules as $civiModule) { | |
222 | if (!file_exists($civiModule['filePath'])) { | |
223 | CRM_Core_Session::setStatus( | |
9399901d KJ |
224 | ts( 'Error loading module file (%1). Please restore the file or disable the module.', |
225 | array(1 => $civiModule['filePath']) ), | |
1393e47e | 226 | ts( 'Warning'), 'error'); |
6a488035 TO |
227 | continue; |
228 | } | |
229 | include_once $civiModule['filePath']; | |
230 | $moduleList[$civiModule['prefix']] = $civiModule['prefix']; | |
231 | } | |
232 | } | |
233 | ||
234 | /** | |
235 | * This hook is called before a db write on some core objects. | |
236 | * This hook does not allow the abort of the operation | |
237 | * | |
238 | * @param string $op the type of operation being performed | |
239 | * @param string $objectName the name of the object | |
240 | * @param object $id the object id if available | |
241 | * @param array $params the parameters used for object creation / editing | |
242 | * | |
243 | * @return null the return value is ignored | |
6a488035 TO |
244 | */ |
245 | static function pre($op, $objectName, $id, &$params) { | |
87dab4a4 | 246 | return self::singleton()->invoke(4, $op, $objectName, $id, $params, self::$_nullObject, self::$_nullObject, 'civicrm_pre'); |
6a488035 TO |
247 | } |
248 | ||
249 | /** | |
250 | * This hook is called after a db write on some core objects. | |
251 | * | |
252 | * @param string $op the type of operation being performed | |
253 | * @param string $objectName the name of the object | |
254 | * @param int $objectId the unique identifier for the object | |
255 | * @param object $objectRef the reference to the object if available | |
256 | * | |
257 | * @return mixed based on op. pre-hooks return a boolean or | |
258 | * an error message which aborts the operation | |
259 | * @access public | |
260 | */ | |
261 | static function post($op, $objectName, $objectId, &$objectRef) { | |
87dab4a4 | 262 | return self::singleton()->invoke(4, $op, $objectName, $objectId, $objectRef, self::$_nullObject, self::$_nullObject, 'civicrm_post'); |
6a488035 TO |
263 | } |
264 | ||
6a488035 TO |
265 | /** |
266 | * This hook retrieves links from other modules and injects it into | |
267 | * the view contact tabs | |
268 | * | |
269 | * @param string $op the type of operation being performed | |
270 | * @param string $objectName the name of the object | |
271 | * @param int $objectId the unique identifier for the object | |
87dab4a4 AH |
272 | * @param array $links (optional) the links array (introduced in v3.2) |
273 | * @param int $mask (optional) the bitmask to show/hide links | |
274 | * @param array $values (optional) the values to fill the links | |
6a488035 | 275 | * |
de8e002f | 276 | * @return null the return value is ignored |
6a488035 | 277 | */ |
87dab4a4 AH |
278 | static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = array()) { |
279 | return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links'); | |
6a488035 TO |
280 | } |
281 | ||
282 | /** | |
283 | * This hook is invoked when building a CiviCRM form. This hook should also | |
284 | * be used to set the default values of a form element | |
285 | * | |
286 | * @param string $formName the name of the form | |
287 | * @param object $form reference to the form object | |
288 | * | |
289 | * @return null the return value is ignored | |
290 | */ | |
291 | static function buildForm($formName, &$form) { | |
87dab4a4 | 292 | return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_buildForm'); |
6a488035 TO |
293 | } |
294 | ||
295 | /** | |
296 | * This hook is invoked when a CiviCRM form is submitted. If the module has injected | |
297 | * any form elements, this hook should save the values in the database | |
298 | * | |
299 | * @param string $formName the name of the form | |
300 | * @param object $form reference to the form object | |
301 | * | |
302 | * @return null the return value is ignored | |
303 | */ | |
304 | static function postProcess($formName, &$form) { | |
87dab4a4 | 305 | return self::singleton()->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_postProcess'); |
6a488035 TO |
306 | } |
307 | ||
308 | /** | |
309 | * This hook is invoked during all CiviCRM form validation. An array of errors | |
310 | * detected is returned. Else we assume validation succeeded. | |
311 | * | |
312 | * @param string $formName the name of the form | |
313 | * @param array &$fields the POST parameters as filtered by QF | |
314 | * @param array &$files the FILES parameters as sent in by POST | |
315 | * @param array &$form the form object | |
316 | * | |
317 | * @return mixed formRule hooks return a boolean or | |
318 | * an array of error messages which display a QF Error | |
6a488035 TO |
319 | */ |
320 | static function validate($formName, &$fields, &$files, &$form) { | |
87dab4a4 | 321 | return self::singleton()->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate'); |
6a488035 TO |
322 | } |
323 | ||
324 | /** | |
325 | * This hook is invoked during all CiviCRM form validation. An array of errors | |
326 | * detected is returned. Else we assume validation succeeded. | |
327 | * | |
328 | * @param string $formName the name of the form | |
329 | * @param array &$fields the POST parameters as filtered by QF | |
330 | * @param array &$files the FILES parameters as sent in by POST | |
331 | * @param array &$form the form object | |
332 | * @param array &$errors the array of errors. | |
333 | * | |
334 | * @return mixed formRule hooks return a boolean or | |
335 | * an array of error messages which display a QF Error | |
6a488035 TO |
336 | */ |
337 | static function validateForm($formName, &$fields, &$files, &$form, &$errors) { | |
87dab4a4 | 338 | return self::singleton()->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm'); |
6a488035 TO |
339 | } |
340 | ||
341 | /** | |
342 | * This hook is called before a db write on a custom table | |
343 | * | |
344 | * @param string $op the type of operation being performed | |
345 | * @param string $groupID the custom group ID | |
346 | * @param object $entityID the entityID of the row in the custom table | |
347 | * @param array $params the parameters that were sent into the calling function | |
348 | * | |
349 | * @return null the return value is ignored | |
6a488035 TO |
350 | */ |
351 | static function custom($op, $groupID, $entityID, &$params) { | |
87dab4a4 | 352 | return self::singleton()->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom'); |
6a488035 TO |
353 | } |
354 | ||
355 | /** | |
356 | * This hook is called when composing the ACL where clause to restrict | |
357 | * visibility of contacts to the logged in user | |
358 | * | |
359 | * @param int $type the type of permission needed | |
360 | * @param array $tables (reference ) add the tables that are needed for the select clause | |
361 | * @param array $whereTables (reference ) add the tables that are needed for the where clause | |
362 | * @param int $contactID the contactID for whom the check is made | |
363 | * @param string $where the currrent where clause | |
364 | * | |
365 | * @return null the return value is ignored | |
6a488035 TO |
366 | */ |
367 | static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) { | |
87dab4a4 | 368 | return self::singleton()->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause'); |
6a488035 TO |
369 | } |
370 | ||
371 | /** | |
372 | * This hook is called when composing the ACL where clause to restrict | |
373 | * visibility of contacts to the logged in user | |
374 | * | |
375 | * @param int $type the type of permission needed | |
376 | * @param int $contactID the contactID for whom the check is made | |
377 | * @param string $tableName the tableName which is being permissioned | |
378 | * @param array $allGroups the set of all the objects for the above table | |
379 | * @param array $currentGroups the set of objects that are currently permissioned for this contact | |
380 | * | |
381 | * @return null the return value is ignored | |
6a488035 TO |
382 | */ |
383 | static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) { | |
87dab4a4 | 384 | return self::singleton()->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup'); |
6a488035 TO |
385 | } |
386 | ||
387 | /** | |
388 | * This hook is called when building the menu table | |
389 | * | |
390 | * @param array $files The current set of files to process | |
391 | * | |
392 | * @return null the return value is ignored | |
6a488035 TO |
393 | */ |
394 | static function xmlMenu(&$files) { | |
395 | return self::singleton()->invoke(1, $files, | |
87dab4a4 | 396 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
397 | 'civicrm_xmlMenu' |
398 | ); | |
399 | } | |
400 | ||
401 | /** | |
402 | * This hook is called for declaring managed entities via API | |
403 | * | |
404 | * @param array $entities List of pending entities | |
405 | * | |
406 | * @return null the return value is ignored | |
407 | * @access public | |
408 | */ | |
409 | static function managed(&$entities) { | |
410 | return self::singleton()->invoke(1, $entities, | |
87dab4a4 | 411 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
412 | 'civicrm_managed' |
413 | ); | |
414 | } | |
415 | ||
416 | /** | |
417 | * This hook is called when rendering the dashboard (q=civicrm/dashboard) | |
418 | * | |
419 | * @param int $contactID - the contactID for whom the dashboard is being rendered | |
9399901d KJ |
420 | * @param int $contentPlacement - (output parameter) where should the hook content be displayed |
421 | * relative to the activity list | |
6a488035 TO |
422 | * |
423 | * @return string the html snippet to include in the dashboard | |
424 | * @access public | |
425 | */ | |
426 | static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) { | |
427 | $retval = self::singleton()->invoke(2, $contactID, $contentPlacement, | |
87dab4a4 | 428 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
429 | 'civicrm_dashboard' |
430 | ); | |
431 | ||
432 | /* | |
433 | * Note we need this seemingly unnecessary code because in the event that the implementation | |
434 | * of the hook declares the second parameter but doesn't set it, then it comes back unset even | |
435 | * though we have a default value in this function's declaration above. | |
436 | */ | |
437 | if (!isset($contentPlacement)) { | |
438 | $contentPlacement = self::DASHBOARD_BELOW; | |
439 | } | |
440 | ||
441 | return $retval; | |
442 | } | |
443 | ||
444 | /** | |
445 | * This hook is called before storing recently viewed items. | |
446 | * | |
447 | * @param array $recentArray - an array of recently viewed or processed items, for in place modification | |
448 | * | |
449 | * @return array | |
450 | * @access public | |
451 | */ | |
452 | static function recent(&$recentArray) { | |
453 | return self::singleton()->invoke(1, $recentArray, | |
87dab4a4 | 454 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
455 | 'civicrm_recent' |
456 | ); | |
457 | } | |
458 | ||
459 | /** | |
460 | * This hook is called when building the amount structure for a Contribution or Event Page | |
461 | * | |
462 | * @param int $pageType - is this a contribution or event page | |
463 | * @param object $form - reference to the form object | |
464 | * @param array $amount - the amount structure to be displayed | |
465 | * | |
466 | * @return null | |
467 | * @access public | |
468 | */ | |
469 | static function buildAmount($pageType, &$form, &$amount) { | |
9399901d | 470 | return self::singleton()->invoke(3, $pageType, $form, $amount, self::$_nullObject, |
87dab4a4 | 471 | self::$_nullObject, self::$_nullObject, 'civicrm_buildAmount'); |
6a488035 TO |
472 | } |
473 | ||
474 | /** | |
475 | * This hook is called when building the state list for a particular country. | |
476 | * | |
72536736 AH |
477 | * @param array $countryID |
478 | * The country id whose states are being selected. | |
479 | * @param $states | |
6a488035 TO |
480 | * |
481 | * @return null | |
6a488035 TO |
482 | */ |
483 | static function buildStateProvinceForCountry($countryID, &$states) { | |
484 | return self::singleton()->invoke(2, $countryID, $states, | |
87dab4a4 | 485 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
486 | 'civicrm_buildStateProvinceForCountry' |
487 | ); | |
488 | } | |
489 | ||
490 | /** | |
491 | * This hook is called when rendering the tabs for a contact (q=civicrm/contact/view)c | |
492 | * | |
493 | * @param array $tabs - the array of tabs that will be displayed | |
494 | * @param int $contactID - the contactID for whom the dashboard is being rendered | |
495 | * | |
496 | * @return null | |
6a488035 TO |
497 | */ |
498 | static function tabs(&$tabs, $contactID) { | |
499 | return self::singleton()->invoke(2, $tabs, $contactID, | |
87dab4a4 | 500 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabs' |
6a488035 TO |
501 | ); |
502 | } | |
503 | ||
fa3dbfbd | 504 | /** |
72536736 AH |
505 | * This hook is called when rendering the tabs used for events and potentially |
506 | * contribution pages, etc. | |
507 | * | |
508 | * @param string $tabsetName | |
509 | * Name of the screen or visual element. | |
510 | * @param array $tabs | |
511 | * Tabs that will be displayed. | |
512 | * @param array $context | |
513 | * Extra data about the screen or context in which the tab is used. | |
fa3dbfbd | 514 | * |
2efcf0c2 | 515 | * @return null |
fa3dbfbd | 516 | */ |
379a8439 | 517 | static function tabset($tabsetName, &$tabs, $context) { |
518 | return self::singleton()->invoke(3, $tabsetName, $tabs, | |
87dab4a4 | 519 | $context, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabset' |
fa3dbfbd | 520 | ); |
521 | } | |
522 | ||
6a488035 TO |
523 | /** |
524 | * This hook is called when sending an email / printing labels | |
525 | * | |
526 | * @param array $tokens - the list of tokens that can be used for the contact | |
527 | * | |
528 | * @return null | |
529 | * @access public | |
530 | */ | |
531 | static function tokens(&$tokens) { | |
532 | return self::singleton()->invoke(1, $tokens, | |
87dab4a4 | 533 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tokens' |
6a488035 TO |
534 | ); |
535 | } | |
536 | ||
537 | /** | |
538 | * This hook is called when sending an email / printing labels to get the values for all the | |
539 | * tokens returned by the 'tokens' hook | |
540 | * | |
541 | * @param array $details - the array to store the token values indexed by contactIDs (unless it a single) | |
542 | * @param array $contactIDs - an array of contactIDs | |
543 | * @param int $jobID - the jobID if this is associated with a CiviMail mailing | |
544 | * @param array $tokens - the list of tokens associated with the content | |
545 | * @param string $className - the top level className from where the hook is invoked | |
546 | * | |
547 | * @return null | |
548 | * @access public | |
549 | */ | |
550 | static function tokenValues(&$details, | |
551 | $contactIDs, | |
552 | $jobID = NULL, | |
553 | $tokens = array(), | |
554 | $className = NULL | |
555 | ) { | |
87dab4a4 | 556 | return self::singleton()->invoke(5, $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues'); |
6a488035 TO |
557 | } |
558 | ||
559 | /** | |
560 | * This hook is called before a CiviCRM Page is rendered. You can use this hook to insert smarty variables | |
561 | * in a template | |
562 | * | |
563 | * @param object $page - the page that will be rendered | |
564 | * | |
565 | * @return null | |
566 | * @access public | |
567 | */ | |
568 | static function pageRun(&$page) { | |
569 | return self::singleton()->invoke(1, $page, | |
87dab4a4 | 570 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
571 | 'civicrm_pageRun' |
572 | ); | |
573 | } | |
574 | ||
575 | /** | |
576 | * This hook is called after a copy of an object has been made. The current objects are | |
577 | * Event, Contribution Page and UFGroup | |
578 | * | |
579 | * @param string $objectName - name of the object | |
580 | * @param object $object - reference to the copy | |
581 | * | |
582 | * @return null | |
583 | * @access public | |
584 | */ | |
585 | static function copy($objectName, &$object) { | |
586 | return self::singleton()->invoke(2, $objectName, $object, | |
87dab4a4 | 587 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
588 | 'civicrm_copy' |
589 | ); | |
590 | } | |
591 | ||
592 | /** | |
593 | * This hook is called when a contact unsubscribes from a mailing. It allows modules | |
594 | * to override what the contacts are removed from. | |
595 | * | |
72536736 AH |
596 | * @param string $op |
597 | * Ignored for now | |
598 | * @param int $mailingId | |
599 | * The id of the mailing to unsub from | |
600 | * @param int $contactId | |
601 | * The id of the contact who is unsubscribing | |
602 | * @param array|int $groups | |
603 | * Groups the contact will be removed from. | |
604 | * @param array|int $baseGroups | |
605 | * Base groups (used in smart mailings) the contact will be removed from. | |
606 | * | |
dcbd3a55 | 607 | * |
72536736 AH |
608 | * @return mixed |
609 | */ | |
6a488035 | 610 | static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) { |
87dab4a4 | 611 | return self::singleton()->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups'); |
6a488035 TO |
612 | } |
613 | ||
614 | /** | |
9399901d KJ |
615 | * This hook is called when CiviCRM needs to edit/display a custom field with options (select, radio, checkbox, |
616 | * adv multiselect) | |
6a488035 TO |
617 | * |
618 | * @param int $customFieldID - the custom field ID | |
619 | * @param array $options - the current set of options for that custom field. | |
620 | * You can add/remove existing options. | |
9399901d KJ |
621 | * Important: This array may contain meta-data about the field that is needed elsewhere, so it is important |
622 | * to be careful to not overwrite the array. | |
6a488035 | 623 | * Only add/edit/remove the specific field options you intend to affect. |
9399901d KJ |
624 | * @param boolean $detailedFormat - if true, |
625 | * the options are in an ID => array ( 'id' => ID, 'label' => label, 'value' => value ) format | |
e09fe81d | 626 | * @param array $selectAttributes contain select attribute(s) if any |
72536736 AH |
627 | * |
628 | * @return mixed | |
6a488035 | 629 | */ |
e09fe81d | 630 | static function customFieldOptions($customFieldID, &$options, $detailedFormat = FALSE, $selectAttributes = array()) { |
6a488035 | 631 | return self::singleton()->invoke(3, $customFieldID, $options, $detailedFormat, |
87dab4a4 | 632 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
633 | 'civicrm_customFieldOptions' |
634 | ); | |
635 | } | |
636 | ||
637 | /** | |
638 | * | |
639 | * This hook is called to display the list of actions allowed after doing a search. | |
640 | * This allows the module developer to inject additional actions or to remove existing actions. | |
641 | * | |
642 | * @param string $objectType - the object type for this search | |
643 | * - activity, campaign, case, contact, contribution, event, grant, membership, and pledge are supported. | |
644 | * @param array $tasks - the current set of tasks for that custom field. | |
645 | * You can add/remove existing tasks. | |
9399901d KJ |
646 | * Each task needs to have a title (eg 'title' => ts( 'Add Contacts to Group')) and a class |
647 | * (eg 'class' => 'CRM_Contact_Form_Task_AddToGroup'). | |
6a488035 | 648 | * Optional result (boolean) may also be provided. Class can be an array of classes (not sure what that does :( ). |
9399901d KJ |
649 | * The key for new Task(s) should not conflict with the keys for core tasks of that $objectType, which can be |
650 | * found in CRM/$objectType/Task.php. | |
72536736 AH |
651 | * |
652 | * @return mixed | |
6a488035 TO |
653 | */ |
654 | static function searchTasks($objectType, &$tasks) { | |
655 | return self::singleton()->invoke(2, $objectType, $tasks, | |
87dab4a4 | 656 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
657 | 'civicrm_searchTasks' |
658 | ); | |
659 | } | |
660 | ||
72536736 AH |
661 | /** |
662 | * @param mixed $form | |
663 | * @param array $params | |
664 | * | |
665 | * @return mixed | |
666 | */ | |
6a488035 TO |
667 | static function eventDiscount(&$form, &$params) { |
668 | return self::singleton()->invoke(2, $form, $params, | |
87dab4a4 | 669 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
670 | 'civicrm_eventDiscount' |
671 | ); | |
672 | } | |
673 | ||
674 | /** | |
675 | * This hook is called when composing a mailing. You can include / exclude other groups as needed. | |
676 | * | |
72536736 AH |
677 | * @param mixed $form |
678 | * The form object for which groups / mailings being displayed | |
679 | * @param array $groups | |
680 | * The list of groups being included / excluded | |
681 | * @param array $mailings | |
682 | * The list of mailings being included / excluded | |
683 | * | |
684 | * @return mixed | |
6a488035 TO |
685 | */ |
686 | static function mailingGroups(&$form, &$groups, &$mailings) { | |
687 | return self::singleton()->invoke(3, $form, $groups, $mailings, | |
87dab4a4 | 688 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
689 | 'civicrm_mailingGroups' |
690 | ); | |
691 | } | |
692 | ||
693 | /** | |
9399901d KJ |
694 | * This hook is called when composing the array of membershipTypes and their cost during a membership registration |
695 | * (new or renewal). | |
6a488035 TO |
696 | * Note the hook is called on initial page load and also reloaded after submit (PRG pattern). |
697 | * You can use it to alter the membership types when first loaded, or after submission | |
698 | * (for example if you want to gather data in the form and use it to alter the fees). | |
699 | * | |
72536736 AH |
700 | * @param mixed $form |
701 | * The form object that is presenting the page | |
702 | * @param array $membershipTypes | |
703 | * The array of membership types and their amount | |
704 | * | |
705 | * @return mixed | |
6a488035 TO |
706 | */ |
707 | static function membershipTypeValues(&$form, &$membershipTypes) { | |
708 | return self::singleton()->invoke(2, $form, $membershipTypes, | |
87dab4a4 | 709 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
710 | 'civicrm_membershipTypeValues' |
711 | ); | |
712 | } | |
713 | ||
714 | /** | |
715 | * This hook is called when rendering the contact summary | |
716 | * | |
72536736 AH |
717 | * @param int $contactID |
718 | * The contactID for whom the summary is being rendered | |
719 | * @param mixed $content | |
720 | * @param int $contentPlacement | |
721 | * Specifies where the hook content should be displayed relative to the | |
722 | * existing content | |
6a488035 | 723 | * |
72536736 AH |
724 | * @return string |
725 | * The html snippet to include in the contact summary | |
6a488035 TO |
726 | */ |
727 | static function summary($contactID, &$content, &$contentPlacement = self::SUMMARY_BELOW) { | |
728 | return self::singleton()->invoke(3, $contactID, $content, $contentPlacement, | |
87dab4a4 | 729 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
730 | 'civicrm_summary' |
731 | ); | |
732 | } | |
733 | ||
734 | /** | |
735 | * Use this hook to populate the list of contacts returned by Contact Reference custom fields. | |
736 | * By default, Contact Reference fields will search on and return all CiviCRM contacts. | |
737 | * If you want to limit the contacts returned to a specific group, or some other criteria | |
738 | * - you can override that behavior by providing a SQL query that returns some subset of your contacts. | |
739 | * The hook is called when the query is executed to get the list of contacts to display. | |
740 | * | |
72536736 | 741 | * @param mixed $query - - the query that will be executed (input and output parameter); |
6a488035 TO |
742 | * It's important to realize that the ACL clause is built prior to this hook being fired, |
743 | * so your query will ignore any ACL rules that may be defined. | |
744 | * Your query must return two columns: | |
745 | * the contact 'data' to display in the autocomplete dropdown (usually contact.sort_name - aliased as 'data') | |
746 | * the contact IDs | |
747 | * @param string $name - the name string to execute the query against (this is the value being typed in by the user) | |
748 | * @param string $context - the context in which this ajax call is being made (for example: 'customfield', 'caseview') | |
749 | * @param int $id - the id of the object for which the call is being made. | |
750 | * For custom fields, it will be the custom field id | |
72536736 AH |
751 | * |
752 | * @return mixed | |
6a488035 TO |
753 | */ |
754 | static function contactListQuery(&$query, $name, $context, $id) { | |
755 | return self::singleton()->invoke(4, $query, $name, $context, $id, | |
87dab4a4 | 756 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
757 | 'civicrm_contactListQuery' |
758 | ); | |
759 | } | |
760 | ||
761 | /** | |
762 | * Hook definition for altering payment parameters before talking to a payment processor back end. | |
763 | * | |
764 | * Definition will look like this: | |
765 | * | |
766 | * function hook_civicrm_alterPaymentProcessorParams($paymentObj, | |
767 | * &$rawParams, &$cookedParams); | |
768 | * | |
769 | * @param string $paymentObj | |
770 | * instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy') | |
771 | * @param array &$rawParams | |
772 | * array of params as passed to to the processor | |
72536736 | 773 | * @param array &$cookedParams |
6a488035 TO |
774 | * params after the processor code has translated them into its own key/value pairs |
775 | * | |
72536736 | 776 | * @return mixed |
6a488035 TO |
777 | */ |
778 | static function alterPaymentProcessorParams($paymentObj, | |
779 | &$rawParams, | |
780 | &$cookedParams | |
781 | ) { | |
782 | return self::singleton()->invoke(3, $paymentObj, $rawParams, $cookedParams, | |
87dab4a4 | 783 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
784 | 'civicrm_alterPaymentProcessorParams' |
785 | ); | |
786 | } | |
787 | ||
788 | /** | |
789 | * This hook is called when an email is about to be sent by CiviCRM. | |
790 | * | |
72536736 AH |
791 | * @param array $params |
792 | * Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html, | |
9399901d | 793 | * returnPath, replyTo, headers, attachments (array) |
6a488035 | 794 | * @param string $context - the context in which the hook is being invoked, eg 'civimail' |
72536736 AH |
795 | * |
796 | * @return mixed | |
6a488035 TO |
797 | */ |
798 | static function alterMailParams(&$params, $context = NULL) { | |
799 | return self::singleton()->invoke(2, $params, $context, | |
87dab4a4 | 800 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
801 | 'civicrm_alterMailParams' |
802 | ); | |
803 | } | |
804 | ||
5f11bbcc EM |
805 | /** |
806 | * This hook is called when membership status is being calculated | |
807 | * | |
808 | * @param array $membershipStatus membership status details as determined - alter if required | |
809 | * @param array $arguments arguments passed in to calculate date | |
810 | * - 'start_date' | |
811 | * - 'end_date' | |
812 | * - 'status_date' | |
813 | * - 'join_date' | |
814 | * - 'exclude_is_admin' | |
815 | * - 'membership_type_id' | |
816 | * @param array $membership membership details from the calling function | |
817 | */ | |
818 | static function alterCalculatedMembershipStatus(&$membershipStatus, $arguments, $membership) { | |
819 | return self::singleton()->invoke(3, $membershipStatus, $arguments, | |
fc6a608f | 820 | $membership, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
5f11bbcc EM |
821 | 'civicrm_alterCalculatedMembershipStatus' |
822 | ); | |
823 | } | |
824 | ||
6a488035 TO |
825 | /** |
826 | * This hook is called when rendering the Manage Case screen | |
827 | * | |
828 | * @param int $caseID - the case ID | |
829 | * | |
9399901d KJ |
830 | * @return array of data to be displayed, where the key is a unique id to be used for styling (div id's) |
831 | * and the value is an array with keys 'label' and 'value' specifying label/value pairs | |
6a488035 TO |
832 | * @access public |
833 | */ | |
834 | static function caseSummary($caseID) { | |
835 | return self::singleton()->invoke(1, $caseID, | |
87dab4a4 | 836 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
837 | 'civicrm_caseSummary' |
838 | ); | |
839 | } | |
840 | ||
6b86870e TO |
841 | /** |
842 | * This hook is called when locating CiviCase types. | |
843 | * | |
844 | * @param array $caseTypes | |
72536736 AH |
845 | * |
846 | * @return mixed | |
6b86870e TO |
847 | */ |
848 | static function caseTypes(&$caseTypes) { | |
87dab4a4 | 849 | return self::singleton()->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes'); |
6b86870e TO |
850 | } |
851 | ||
6a488035 TO |
852 | /** |
853 | * This hook is called soon after the CRM_Core_Config object has ben initialized. | |
854 | * You can use this hook to modify the config object and hence behavior of CiviCRM dynamically. | |
72536736 AH |
855 | * |
856 | * @param CRM_Core_Config|array $config | |
857 | * The config object | |
858 | * | |
859 | * @return mixed | |
6a488035 TO |
860 | */ |
861 | static function config(&$config) { | |
862 | return self::singleton()->invoke(1, $config, | |
87dab4a4 | 863 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
864 | 'civicrm_config' |
865 | ); | |
866 | } | |
867 | ||
868 | static function enableDisable($recordBAO, $recordID, $isActive) { | |
869 | return self::singleton()->invoke(3, $recordBAO, $recordID, $isActive, | |
87dab4a4 | 870 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
871 | 'civicrm_enableDisable' |
872 | ); | |
873 | } | |
874 | ||
875 | /** | |
876 | * This hooks allows to change option values | |
877 | * | |
72536736 AH |
878 | * @param array $options |
879 | * Associated array of option values / id | |
880 | * @param string $name | |
881 | * Option group name | |
6a488035 | 882 | * |
72536736 | 883 | * @return mixed |
6a488035 TO |
884 | */ |
885 | static function optionValues(&$options, $name) { | |
886 | return self::singleton()->invoke(2, $options, $name, | |
87dab4a4 | 887 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
888 | 'civicrm_optionValues' |
889 | ); | |
890 | } | |
891 | ||
892 | /** | |
893 | * This hook allows modification of the navigation menu. | |
894 | * | |
72536736 AH |
895 | * @param array $params |
896 | * Associated array of navigation menu entry to Modify/Add | |
897 | * | |
898 | * @return mixed | |
6a488035 TO |
899 | */ |
900 | static function navigationMenu(&$params) { | |
901 | return self::singleton()->invoke(1, $params, | |
87dab4a4 | 902 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
903 | 'civicrm_navigationMenu' |
904 | ); | |
905 | } | |
906 | ||
907 | /** | |
908 | * This hook allows modification of the data used to perform merging of duplicates. | |
909 | * | |
910 | * @param string $type the type of data being passed (cidRefs|eidRefs|relTables|sqls) | |
72536736 AH |
911 | * @param array $data the data, as described in $type |
912 | * @param int $mainId contact_id of the contact that survives the merge | |
6a488035 TO |
913 | * @param int $otherId contact_id of the contact that will be absorbed and deleted |
914 | * @param array $tables when $type is "sqls", an array of tables as it may have been handed to the calling function | |
915 | * | |
72536736 | 916 | * @return mixed |
6a488035 TO |
917 | */ |
918 | static function merge($type, &$data, $mainId = NULL, $otherId = NULL, $tables = NULL) { | |
87dab4a4 | 919 | return self::singleton()->invoke(5, $type, $data, $mainId, $otherId, $tables, self::$_nullObject, 'civicrm_merge'); |
6a488035 TO |
920 | } |
921 | ||
922 | /** | |
923 | * This hook provides a way to override the default privacy behavior for notes. | |
924 | * | |
72536736 AH |
925 | * @param array &$noteValues |
926 | * Associative array of values for this note | |
6a488035 | 927 | * |
72536736 | 928 | * @return mixed |
6a488035 TO |
929 | */ |
930 | static function notePrivacy(&$noteValues) { | |
931 | return self::singleton()->invoke(1, $noteValues, | |
87dab4a4 | 932 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
933 | 'civicrm_notePrivacy' |
934 | ); | |
935 | } | |
936 | ||
937 | /** | |
938 | * This hook is called before record is exported as CSV | |
939 | * | |
940 | * @param string $exportTempTable - name of the temporary export table used during export | |
941 | * @param array $headerRows - header rows for output | |
942 | * @param array $sqlColumns - SQL columns | |
943 | * @param int $exportMode - export mode ( contact, contribution, etc...) | |
944 | * | |
72536736 | 945 | * @return mixed |
6a488035 TO |
946 | */ |
947 | static function export(&$exportTempTable, &$headerRows, &$sqlColumns, &$exportMode) { | |
948 | return self::singleton()->invoke(4, $exportTempTable, $headerRows, $sqlColumns, $exportMode, | |
87dab4a4 | 949 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
950 | 'civicrm_export' |
951 | ); | |
952 | } | |
953 | ||
954 | /** | |
955 | * This hook allows modification of the queries constructed from dupe rules. | |
956 | * | |
957 | * @param string $obj object of rulegroup class | |
958 | * @param string $type type of queries e.g table / threshold | |
959 | * @param array $query set of queries | |
960 | * | |
961 | * @access public | |
962 | */ | |
963 | static function dupeQuery($obj, $type, &$query) { | |
964 | return self::singleton()->invoke(3, $obj, $type, $query, | |
87dab4a4 | 965 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
966 | 'civicrm_dupeQuery' |
967 | ); | |
968 | } | |
969 | ||
970 | /** | |
971 | * This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php | |
972 | * | |
973 | * @param string $type type of mail processed: 'activity' OR 'mailing' | |
974 | * @param array &$params the params that were sent to the CiviCRM API function | |
975 | * @param object $mail the mail object which is an ezcMail class | |
976 | * @param array &$result the result returned by the api call | |
977 | * @param string $action (optional ) the requested action to be performed if the types was 'mailing' | |
978 | * | |
979 | * @access public | |
980 | */ | |
981 | static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) { | |
87dab4a4 | 982 | return self::singleton()->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor'); |
6a488035 TO |
983 | } |
984 | ||
985 | /** | |
986 | * This hook is called after a row has been processed and the | |
987 | * record (and associated records imported | |
988 | * | |
9399901d KJ |
989 | * @param string $object - object being imported (for now Contact only, later Contribution, Activity, |
990 | * Participant and Member) | |
6a488035 TO |
991 | * @param string $usage - hook usage/location (for now process only, later mapping and others) |
992 | * @param string $objectRef - import record object | |
993 | * @param array $params - array with various key values: currently | |
994 | * contactID - contact id | |
995 | * importID - row id in temp table | |
996 | * importTempTable - name of tempTable | |
997 | * fieldHeaders - field headers | |
998 | * fields - import fields | |
999 | * | |
1000 | * @return void | |
1001 | * @access public | |
1002 | */ | |
1003 | static function import($object, $usage, &$objectRef, &$params) { | |
1004 | return self::singleton()->invoke(4, $object, $usage, $objectRef, $params, | |
87dab4a4 | 1005 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1006 | 'civicrm_import' |
1007 | ); | |
1008 | } | |
1009 | ||
1010 | /** | |
1011 | * This hook is called when API permissions are checked (cf. civicrm_api3_api_check_permission() | |
aa5ba569 | 1012 | * in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/permissions.php). |
6a488035 TO |
1013 | * |
1014 | * @param string $entity the API entity (like contact) | |
1015 | * @param string $action the API action (like get) | |
1016 | * @param array &$params the API parameters | |
1017 | * @param array &$permisisons the associative permissions array (probably to be altered by this hook) | |
1018 | */ | |
1019 | static function alterAPIPermissions($entity, $action, &$params, &$permissions) { | |
1020 | return self::singleton()->invoke(4, $entity, $action, $params, $permissions, | |
87dab4a4 | 1021 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1022 | 'civicrm_alterAPIPermissions' |
1023 | ); | |
1024 | } | |
1025 | ||
1026 | static function postSave(&$dao) { | |
1027 | $hookName = 'civicrm_postSave_' . $dao->getTableName(); | |
1028 | return self::singleton()->invoke(1, $dao, | |
87dab4a4 | 1029 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1030 | $hookName |
1031 | ); | |
1032 | } | |
1033 | ||
1034 | /** | |
1035 | * This hook allows user to customize context menu Actions on contact summary page. | |
1036 | * | |
1037 | * @param array $actions Array of all Actions in contextmenu. | |
1038 | * @param int $contactID ContactID for the summary page | |
1039 | */ | |
1040 | static function summaryActions(&$actions, $contactID = NULL) { | |
1041 | return self::singleton()->invoke(2, $actions, $contactID, | |
87dab4a4 | 1042 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1043 | 'civicrm_summaryActions' |
1044 | ); | |
1045 | } | |
1046 | ||
1047 | /** | |
1048 | * This hook is called from CRM_Core_Selector_Controller through which all searches in civicrm go. | |
1049 | * This enables us hook implementors to modify both the headers and the rows | |
1050 | * | |
1051 | * The BIGGEST drawback with this hook is that you may need to modify the result template to include your | |
1052 | * fields. The result files are CRM/{Contact,Contribute,Member,Event...}/Form/Selector.tpl | |
1053 | * | |
1054 | * However, if you use the same number of columns, you can overwrite the existing columns with the values that | |
1055 | * you want displayed. This is a hackish, but avoids template modification. | |
1056 | * | |
1057 | * @param string $objectName the component name that we are doing the search | |
1058 | * activity, campaign, case, contact, contribution, event, grant, membership, and pledge | |
1059 | * @param array &$headers the list of column headers, an associative array with keys: ( name, sort, order ) | |
1060 | * @param array &$rows the list of values, an associate array with fields that are displayed for that component | |
1061 | * @param array &$seletor the selector object. Allows you access to the context of the search | |
1062 | * | |
1063 | * @return void modify the header and values object to pass the data u need | |
1064 | */ | |
1065 | static function searchColumns($objectName, &$headers, &$rows, &$selector) { | |
1066 | return self::singleton()->invoke(4, $objectName, $headers, $rows, $selector, | |
87dab4a4 | 1067 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1068 | 'civicrm_searchColumns' |
1069 | ); | |
1070 | } | |
1071 | ||
1072 | /** | |
1073 | * This hook is called when uf groups are being built for a module. | |
1074 | * | |
1075 | * @param string $moduleName module name. | |
1076 | * @param array $ufGroups array of ufgroups for a module. | |
1077 | * | |
1078 | * @return null | |
1079 | * @access public | |
1080 | */ | |
1081 | static function buildUFGroupsForModule($moduleName, &$ufGroups) { | |
1082 | return self::singleton()->invoke(2, $moduleName, $ufGroups, | |
87dab4a4 | 1083 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1084 | 'civicrm_buildUFGroupsForModule' |
1085 | ); | |
1086 | } | |
1087 | ||
1088 | /** | |
1089 | * This hook is called when we are determining the contactID for a specific | |
1090 | * email address | |
1091 | * | |
1092 | * @param string $email the email address | |
1093 | * @param int $contactID the contactID that matches this email address, IF it exists | |
1094 | * @param array $result (reference) has two fields | |
1095 | * contactID - the new (or same) contactID | |
1096 | * action - 3 possible values: | |
9399901d KJ |
1097 | * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_CREATE_INDIVIDUAL - create a new contact record |
1098 | * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_OVERRIDE - use the new contactID | |
1099 | * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_IGNORE - skip this email address | |
6a488035 TO |
1100 | * |
1101 | * @return null | |
1102 | * @access public | |
1103 | */ | |
1104 | static function emailProcessorContact($email, $contactID, &$result) { | |
1105 | return self::singleton()->invoke(3, $email, $contactID, $result, | |
87dab4a4 | 1106 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1107 | 'civicrm_emailProcessorContact' |
1108 | ); | |
1109 | } | |
1110 | ||
1111 | /** | |
1112 | * Hook definition for altering the generation of Mailing Labels | |
1113 | * | |
1114 | * @param array $args an array of the args in the order defined for the tcpdf multiCell api call | |
1115 | * with the variable names below converted into string keys (ie $w become 'w' | |
1116 | * as the first key for $args) | |
1117 | * float $w Width of cells. If 0, they extend up to the right margin of the page. | |
1118 | * float $h Cell minimum height. The cell extends automatically if needed. | |
1119 | * string $txt String to print | |
1120 | * mixed $border Indicates if borders must be drawn around the cell block. The value can | |
1121 | * be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or | |
1122 | * a string containing some or all of the following characters (in any order): | |
1123 | * <ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> | |
1124 | * string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: | |
1125 | * left align</li><li>C: center</li><li>R: right align</li><li>J: justification | |
1126 | * (default value when $ishtml=false)</li></ul> | |
1127 | * int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. | |
1128 | * int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: | |
1129 | * to the right</li><li>1: to the beginning of the next line [DEFAULT]</li><li>2: below</li></ul> | |
1130 | * float $x x position in user units | |
1131 | * float $y y position in user units | |
1132 | * boolean $reseth if true reset the last cell height (default true). | |
1133 | * int $stretch stretch carachter mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if | |
1134 | * necessary</li><li>2 = forced horizontal scaling</li><li>3 = character spacing only if | |
1135 | * necessary</li><li>4 = forced character spacing</li></ul> | |
1136 | * boolean $ishtml set to true if $txt is HTML content (default = false). | |
1137 | * boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width. | |
1138 | * float $maxh maximum height. It should be >= $h and less then remaining space to the bottom of the page, | |
1139 | * or 0 for disable this feature. This feature works only when $ishtml=false. | |
1140 | * | |
1141 | */ | |
1142 | static function alterMailingLabelParams(&$args) { | |
1143 | return self::singleton()->invoke(1, $args, | |
1144 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1145 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1146 | 'civicrm_alterMailingLabelParams' |
1147 | ); | |
1148 | } | |
1149 | ||
1150 | /** | |
1151 | * This hooks allows alteration of generated page content | |
1152 | * | |
1153 | * @param $content previously generated content | |
1154 | * @param $context context of content - page or form | |
1155 | * @param $tplName the file name of the tpl | |
1156 | * @param $object a reference to the page or form object | |
1157 | * | |
1158 | * @access public | |
1159 | */ | |
1160 | static function alterContent(&$content, $context, $tplName, &$object) { | |
1161 | return self::singleton()->invoke(4, $content, $context, $tplName, $object, | |
87dab4a4 | 1162 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1163 | 'civicrm_alterContent' |
1164 | ); | |
1165 | } | |
1166 | ||
8aac22c8 | 1167 | /** |
1168 | * This hooks allows alteration of the tpl file used to generate content. It differs from the | |
1169 | * altercontent hook as the content has already been rendered through the tpl at that point | |
1170 | * | |
1171 | * @param $formName previously generated content | |
1172 | * @param $form reference to the form object | |
1173 | * @param $context context of content - page or form | |
1174 | * @param $tplName reference the file name of the tpl | |
1175 | * | |
1176 | * @access public | |
1177 | */ | |
1178 | static function alterTemplateFile($formName, &$form, $context, &$tplName) { | |
1179 | return self::singleton()->invoke(4, $formName, $form, $context, $tplName, | |
87dab4a4 | 1180 | self::$_nullObject, self::$_nullObject, |
8aac22c8 | 1181 | 'civicrm_alterTemplateFile' |
1182 | ); | |
1183 | } | |
6a488035 TO |
1184 | /** |
1185 | * This hook collects the trigger definition from all components | |
1186 | * | |
1187 | * @param $triggerInfo reference to an array of trigger information | |
1188 | * each element has 4 fields: | |
1189 | * table - array of tableName | |
1190 | * when - BEFORE or AFTER | |
1191 | * event - array of eventName - INSERT OR UPDATE OR DELETE | |
1192 | * sql - array of statements optionally terminated with a ; | |
1193 | * a statement can use the tokes {tableName} and {eventName} | |
1194 | * to do token replacement with the table / event. This allows | |
1195 | * templatizing logging and other hooks | |
1196 | * @param string $tableName (optional) the name of the table that we are interested in only | |
1197 | */ | |
1198 | static function triggerInfo(&$info, $tableName = NULL) { | |
1199 | return self::singleton()->invoke(2, $info, $tableName, | |
87dab4a4 | 1200 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1201 | self::$_nullObject, |
1202 | 'civicrm_triggerInfo' | |
1203 | ); | |
1204 | } | |
1205 | ||
1206 | /** | |
1207 | * This hook is called when a module-extension is installed. | |
9399901d KJ |
1208 | * Each module will receive hook_civicrm_install during its own installation (but not during the |
1209 | * installation of unrelated modules). | |
6a488035 TO |
1210 | */ |
1211 | static function install() { | |
1212 | return self::singleton()->invoke(0, self::$_nullObject, | |
1213 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1214 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1215 | 'civicrm_install' |
1216 | ); | |
1217 | } | |
1218 | ||
1219 | /** | |
1220 | * This hook is called when a module-extension is uninstalled. | |
9399901d KJ |
1221 | * Each module will receive hook_civicrm_uninstall during its own uninstallation (but not during the |
1222 | * uninstallation of unrelated modules). | |
6a488035 TO |
1223 | */ |
1224 | static function uninstall() { | |
1225 | return self::singleton()->invoke(0, self::$_nullObject, | |
1226 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1227 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1228 | 'civicrm_uninstall' |
1229 | ); | |
1230 | } | |
1231 | ||
1232 | /** | |
1233 | * This hook is called when a module-extension is re-enabled. | |
9399901d KJ |
1234 | * Each module will receive hook_civicrm_enable during its own re-enablement (but not during the |
1235 | * re-enablement of unrelated modules). | |
6a488035 TO |
1236 | */ |
1237 | static function enable() { | |
1238 | return self::singleton()->invoke(0, self::$_nullObject, | |
1239 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1240 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1241 | 'civicrm_enable' |
1242 | ); | |
1243 | } | |
1244 | ||
1245 | /** | |
1246 | * This hook is called when a module-extension is disabled. | |
9399901d KJ |
1247 | * Each module will receive hook_civicrm_disable during its own disablement (but not during the |
1248 | * disablement of unrelated modules). | |
6a488035 TO |
1249 | */ |
1250 | static function disable() { | |
1251 | return self::singleton()->invoke(0, self::$_nullObject, | |
1252 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1253 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1254 | 'civicrm_disable' |
1255 | ); | |
1256 | } | |
1257 | ||
1258 | static function alterReportVar($varType, &$var, &$object) { | |
1259 | return self::singleton()->invoke(3, $varType, $var, $object, | |
1260 | self::$_nullObject, | |
87dab4a4 | 1261 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1262 | 'civicrm_alterReportVar' |
1263 | ); | |
1264 | } | |
1265 | ||
1266 | /** | |
1267 | * This hook is called to drive database upgrades for extension-modules. | |
1268 | * | |
72536736 AH |
1269 | * @param string $op |
1270 | * The type of operation being performed; 'check' or 'enqueue'. | |
1271 | * @param CRM_Queue_Queue $queue | |
1272 | * (for 'enqueue') the modifiable list of pending up upgrade tasks. | |
6a488035 | 1273 | * |
72536736 AH |
1274 | * @return bool|null |
1275 | * NULL, if $op is 'enqueue'. | |
1276 | * TRUE, if $op is 'check' and upgrades are pending. | |
1277 | * FALSE, if $op is 'check' and upgrades are not pending. | |
6a488035 TO |
1278 | */ |
1279 | static function upgrade($op, CRM_Queue_Queue $queue = NULL) { | |
1280 | return self::singleton()->invoke(2, $op, $queue, | |
87dab4a4 | 1281 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1282 | self::$_nullObject, |
1283 | 'civicrm_upgrade' | |
1284 | ); | |
1285 | } | |
1286 | ||
1287 | /** | |
1288 | * This hook is called when an email has been successfully sent by CiviCRM, but not on an error. | |
1289 | * | |
72536736 AH |
1290 | * @param array $params |
1291 | * The mailing parameters. Array fields include: groupName, from, toName, | |
1292 | * toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers, | |
1293 | * attachments (array) | |
1294 | * | |
1295 | * @return mixed | |
6a488035 TO |
1296 | */ |
1297 | static function postEmailSend(&$params) { | |
1298 | return self::singleton()->invoke(1, $params, | |
1299 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1300 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1301 | 'civicrm_postEmailSend' |
1302 | ); | |
1303 | } | |
1304 | ||
1305 | /** | |
1306 | * This hook is called when Settings specifications are loaded | |
1307 | * | |
72536736 AH |
1308 | * @param array $settingsFolders |
1309 | * List of paths from which to derive metadata | |
1310 | * | |
1311 | * @return mixed | |
6a488035 TO |
1312 | */ |
1313 | static function alterSettingsFolders(&$settingsFolders) { | |
1314 | return self::singleton()->invoke(1, $settingsFolders, | |
1315 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1316 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1317 | 'civicrm_alterSettingsFolders' |
1318 | ); | |
1319 | } | |
1320 | ||
1321 | /** | |
1322 | * This hook is called when Settings have been loaded from the xml | |
1323 | * It is an opportunity for hooks to alter the data | |
1324 | * | |
1325 | * @param array $settingsMetaData - Settings Metadata | |
72536736 AH |
1326 | * @param int $domainID |
1327 | * @param mixed $profile | |
1328 | * | |
1329 | * @return mixed | |
6a488035 TO |
1330 | */ |
1331 | static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) { | |
1332 | return self::singleton()->invoke(3, $settingsMetaData, | |
1333 | $domainID, $profile, | |
87dab4a4 | 1334 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1335 | 'civicrm_alterSettingsMetaData' |
1336 | ); | |
1337 | } | |
1338 | ||
5270c026 XD |
1339 | /** |
1340 | * This hook is called before running an api call. | |
1341 | * | |
72536736 AH |
1342 | * @param API_Wrapper[] $wrappers |
1343 | * (see CRM_Utils_API_ReloadOption as an example) | |
1344 | * @param mixed $apiRequest | |
5270c026 | 1345 | * |
72536736 AH |
1346 | * @return null |
1347 | * The return value is ignored | |
5270c026 | 1348 | */ |
09f8c8dc TO |
1349 | static function apiWrappers(&$wrappers, $apiRequest) { |
1350 | return self::singleton() | |
1351 | ->invoke(2, $wrappers, $apiRequest, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1352 | self::$_nullObject, 'civicrm_apiWrappers' |
5270c026 XD |
1353 | ); |
1354 | } | |
1355 | ||
6a488035 TO |
1356 | /** |
1357 | * This hook is called before running pending cron jobs. | |
1358 | * | |
1359 | * @param CRM_Core_JobManager $jobManager | |
1360 | * | |
72536736 AH |
1361 | * @return null |
1362 | * The return value is ignored. | |
6a488035 TO |
1363 | */ |
1364 | static function cron($jobManager) { | |
1365 | return self::singleton()->invoke(1, | |
87dab4a4 | 1366 | $jobManager, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1367 | 'civicrm_cron' |
1368 | ); | |
1369 | } | |
1370 | ||
1371 | /** | |
1372 | * This hook is called when loading CMS permissions; use this hook to modify | |
1373 | * the array of system permissions for CiviCRM. | |
1374 | * | |
72536736 AH |
1375 | * @param array $permissions |
1376 | * Array of permissions. See CRM_Core_Permission::getCorePermissions() for | |
1377 | * the format of this array. | |
6a488035 | 1378 | * |
72536736 AH |
1379 | * @return null |
1380 | * The return value is ignored | |
6a488035 TO |
1381 | */ |
1382 | static function permission(&$permissions) { | |
1383 | return self::singleton()->invoke(1, $permissions, | |
87dab4a4 | 1384 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1385 | 'civicrm_permission' |
1386 | ); | |
1387 | } | |
fed67e4d TO |
1388 | |
1389 | ||
1390 | /** | |
1391 | * This hook is called for declaring managed entities via API | |
1392 | * | |
72536736 AH |
1393 | * @param array[] $entityTypes |
1394 | * List of entity types; each entity-type is an array with keys: | |
fed67e4d TO |
1395 | * - name: string, a unique short name (e.g. "ReportInstance") |
1396 | * - class: string, a PHP DAO class (e.g. "CRM_Report_DAO_Instance") | |
1397 | * - table: string, a SQL table name (e.g. "civicrm_report_instance") | |
1398 | * | |
72536736 AH |
1399 | * @return null |
1400 | * The return value is ignored | |
fed67e4d TO |
1401 | */ |
1402 | static function entityTypes(&$entityTypes) { | |
9399901d | 1403 | return self::singleton()->invoke(1, $entityTypes, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1404 | self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_entityTypes' |
fed67e4d TO |
1405 | ); |
1406 | } | |
a8387f19 TO |
1407 | |
1408 | /** | |
1409 | * This hook is called while preparing a profile form | |
1410 | * | |
1411 | * @param string $name | |
72536736 | 1412 | * @return mixed |
a8387f19 TO |
1413 | */ |
1414 | static function buildProfile($name) { | |
9399901d | 1415 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1416 | self::$_nullObject, self::$_nullObject, 'civicrm_buildProfile'); |
a8387f19 TO |
1417 | } |
1418 | ||
1419 | /** | |
1420 | * This hook is called while validating a profile form submission | |
1421 | * | |
1422 | * @param string $name | |
72536736 | 1423 | * @return mixed |
a8387f19 TO |
1424 | */ |
1425 | static function validateProfile($name) { | |
9399901d | 1426 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1427 | self::$_nullObject, self::$_nullObject, 'civicrm_validateProfile'); |
a8387f19 TO |
1428 | } |
1429 | ||
1430 | /** | |
1431 | * This hook is called processing a valid profile form submission | |
1432 | * | |
1433 | * @param string $name | |
72536736 | 1434 | * @return mixed |
a8387f19 TO |
1435 | */ |
1436 | static function processProfile($name) { | |
9399901d | 1437 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1438 | self::$_nullObject, self::$_nullObject, 'civicrm_processProfile'); |
a8387f19 TO |
1439 | } |
1440 | ||
1441 | /** | |
1442 | * This hook is called while preparing a read-only profile screen | |
1443 | * | |
1444 | * @param string $name | |
72536736 | 1445 | * @return mixed |
a8387f19 TO |
1446 | */ |
1447 | static function viewProfile($name) { | |
9399901d | 1448 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1449 | self::$_nullObject, self::$_nullObject, 'civicrm_viewProfile'); |
a8387f19 TO |
1450 | } |
1451 | ||
1452 | /** | |
1453 | * This hook is called while preparing a list of contacts (based on a profile) | |
1454 | * | |
1455 | * @param string $name | |
72536736 | 1456 | * @return mixed |
a8387f19 TO |
1457 | */ |
1458 | static function searchProfile($name) { | |
9399901d | 1459 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1460 | self::$_nullObject, self::$_nullObject, 'civicrm_searchProfile'); |
9399901d KJ |
1461 | } |
1462 | ||
1463 | /** | |
1464 | * This hook is called before encoding data in barcode | |
1465 | * | |
1466 | * @param array $data associated array of values available for encoding | |
1467 | * @param string $type type of barcode, classic barcode or QRcode | |
1468 | * @param string $context where this hooks is invoked. | |
1469 | * | |
72536736 | 1470 | * @return mixed |
9399901d KJ |
1471 | */ |
1472 | static function alterBarcode( &$data, $type = 'barcode', $context = 'name_badge' ) { | |
1473 | return self::singleton()->invoke(3, $data, $type, $context, self::$_nullObject, | |
87dab4a4 | 1474 | self::$_nullObject, self::$_nullObject, 'civicrm_alterBarcode'); |
a8387f19 | 1475 | } |
99e9587a | 1476 | |
72ad6c1b TO |
1477 | /** |
1478 | * Modify or replace the Mailer object used for outgoing mail. | |
1479 | * | |
1480 | * @param object $mailer | |
1481 | * The default mailer produced by normal configuration; a PEAR "Mail" class (like those returned by Mail::factory) | |
1482 | * @param string $driver | |
1483 | * The type of the default mailer (eg "smtp", "sendmail", "mock", "CRM_Mailing_BAO_Spool") | |
1484 | * @param array $params | |
1485 | * The default mailer config options | |
72536736 AH |
1486 | * |
1487 | * @return mixed | |
72ad6c1b TO |
1488 | * @see Mail::factory |
1489 | */ | |
91bff2e5 | 1490 | static function alterMail(&$mailer, $driver, $params) { |
c8e4bea0 | 1491 | return self::singleton() |
87dab4a4 | 1492 | ->invoke(3, $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer'); |
72ad6c1b TO |
1493 | } |
1494 | ||
99e9587a | 1495 | /** |
2efcf0c2 | 1496 | * This hook is called while building the core search query, |
99e9587a DS |
1497 | * so hook implementers can provide their own query objects which alters/extends core search. |
1498 | * | |
72536736 AH |
1499 | * @param array $queryObjects |
1500 | * @param string $type | |
1501 | * | |
1502 | * @return mixed | |
99e9587a | 1503 | */ |
c3e3dd65 | 1504 | static function queryObjects(&$queryObjects, $type = 'Contact') { |
87dab4a4 | 1505 | return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects'); |
99e9587a | 1506 | } |
15d9b3ae N |
1507 | |
1508 | /** | |
1509 | * This hook is called while viewing contact dashboard | |
1510 | * | |
72536736 AH |
1511 | * @param array $availableDashlets |
1512 | * List of dashlets; each is formatted per api/v3/Dashboard | |
1513 | * @param array $defaultDashlets | |
1514 | * List of dashlets; each is formatted per api/v3/DashboardContact | |
1515 | * | |
1516 | * @return mixed | |
15d9b3ae N |
1517 | */ |
1518 | static function dashboard_defaults($availableDashlets, &$defaultDashlets) { | |
fae54300 | 1519 | return self::singleton()->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults'); |
15d9b3ae | 1520 | } |
6a488035 | 1521 | } |