Merge pull request #17806 from demeritcowboy/mail-report-csv-bom
[civicrm-core.git] / CRM / Utils / Hook.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CiviCRM_Hook
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 abstract class CRM_Utils_Hook {
18
19 // Allowed values for dashboard hook content placement
20 // Default - place content below activity list
21 const DASHBOARD_BELOW = 1;
22 // Place content above activity list
23 const DASHBOARD_ABOVE = 2;
24 // Don't display activity list at all
25 const DASHBOARD_REPLACE = 3;
26
27 // by default - place content below existing content
28 const SUMMARY_BELOW = 1;
29 // place hook content above
30 const SUMMARY_ABOVE = 2;
31 /**
32 *create your own summaries
33 */
34 const SUMMARY_REPLACE = 3;
35
36 /**
37 * Object to pass when an object is required to be passed by params.
38 *
39 * This is supposed to be a convenience but note that it is a bad
40 * pattern as it can get contaminated & result in hard-to-diagnose bugs.
41 *
42 * @var null
43 */
44 public static $_nullObject = NULL;
45
46 /**
47 * We only need one instance of this object. So we use the singleton
48 * pattern and cache the instance in this variable
49 *
50 * @var CRM_Utils_Hook
51 */
52 static private $_singleton = NULL;
53
54 /**
55 * @var bool
56 */
57 private $commonIncluded = FALSE;
58
59 /**
60 * @var array|string
61 */
62 private $commonCiviModules = [];
63
64 /**
65 * @var CRM_Utils_Cache_Interface
66 */
67 protected $cache;
68
69 /**
70 * Constructor and getter for the singleton instance.
71 *
72 * @param bool $fresh
73 *
74 * @return CRM_Utils_Hook
75 * An instance of $config->userHookClass
76 */
77 public static function singleton($fresh = FALSE) {
78 if (self::$_singleton == NULL || $fresh) {
79 $config = CRM_Core_Config::singleton();
80 $class = $config->userHookClass;
81 self::$_singleton = new $class();
82 }
83 return self::$_singleton;
84 }
85
86 /**
87 * CRM_Utils_Hook constructor.
88 *
89 * @throws \CRM_Core_Exception
90 */
91 public function __construct() {
92 $this->cache = CRM_Utils_Cache::create([
93 'name' => 'hooks',
94 'type' => ['ArrayCache'],
95 'prefetch' => 1,
96 ]);
97 }
98
99 /**
100 * Invoke a hook through the UF/CMS hook system and the extension-hook
101 * system.
102 *
103 * @param int $numParams
104 * Number of parameters to pass to the hook.
105 * @param mixed $arg1
106 * Parameter to be passed to the hook.
107 * @param mixed $arg2
108 * Parameter to be passed to the hook.
109 * @param mixed $arg3
110 * Parameter to be passed to the hook.
111 * @param mixed $arg4
112 * Parameter to be passed to the hook.
113 * @param mixed $arg5
114 * Parameter to be passed to the hook.
115 * @param mixed $arg6
116 * Parameter to be passed to the hook.
117 * @param string $fnSuffix
118 * Function suffix, this is effectively the hook name.
119 *
120 * @return mixed
121 */
122 abstract public function invokeViaUF(
123 $numParams,
124 &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
125 $fnSuffix
126 );
127
128 /**
129 * Invoke a hook.
130 *
131 * This is a transitional adapter. It supports the legacy syntax
132 * but also accepts enough information to support Symfony Event
133 * dispatching.
134 *
135 * @param array|int $names
136 * (Recommended) Array of parameter names, in order.
137 * Using an array is recommended because it enables full
138 * event-broadcasting behaviors.
139 * (Legacy) Number of parameters to pass to the hook.
140 * This is provided for transitional purposes.
141 * @param mixed $arg1
142 * @param mixed $arg2
143 * @param mixed $arg3
144 * @param mixed $arg4
145 * @param mixed $arg5
146 * @param mixed $arg6
147 * @param mixed $fnSuffix
148 * @return mixed
149 */
150 public function invoke(
151 $names,
152 &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
153 $fnSuffix
154 ) {
155 if (!is_array($names)) {
156 // We were called with the old contract wherein $names is actually an int.
157 // Symfony dispatcher requires some kind of name.
158 // TODO: Emit a warning, eg
159 // error_log("Warning: hook_$fnSuffix does not give names for its parameters. It will present odd names to any Symfony event listeners.");
160 $compatNames = ['arg1', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6'];
161 $names = array_slice($compatNames, 0, (int) $names);
162 }
163
164 $event = \Civi\Core\Event\GenericHookEvent::createOrdered(
165 $names,
166 array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6)
167 );
168 \Civi::dispatcher()->dispatch('hook_' . $fnSuffix, $event);
169 return $event->getReturnValues();
170 }
171
172 /**
173 * @param array $numParams
174 * @param $arg1
175 * @param $arg2
176 * @param $arg3
177 * @param $arg4
178 * @param $arg5
179 * @param $arg6
180 * @param $fnSuffix
181 * @param $fnPrefix
182 *
183 * @return array|bool
184 */
185 public function commonInvoke(
186 $numParams,
187 &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
188 $fnSuffix, $fnPrefix
189 ) {
190
191 $this->commonBuildModuleList($fnPrefix);
192
193 return $this->runHooks($this->commonCiviModules, $fnSuffix,
194 $numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6
195 );
196 }
197
198 /**
199 * Build the list of modules to be processed for hooks.
200 *
201 * @param string $fnPrefix
202 */
203 public function commonBuildModuleList($fnPrefix) {
204 if (!$this->commonIncluded) {
205 // include external file
206 $this->commonIncluded = TRUE;
207
208 $config = CRM_Core_Config::singleton();
209 if (!empty($config->customPHPPathDir)) {
210 $civicrmHooksFile = CRM_Utils_File::addTrailingSlash($config->customPHPPathDir) . 'civicrmHooks.php';
211 if (file_exists($civicrmHooksFile)) {
212 @include_once $civicrmHooksFile;
213 }
214 }
215
216 if (!empty($fnPrefix)) {
217 $this->commonCiviModules[$fnPrefix] = $fnPrefix;
218 }
219
220 $this->requireCiviModules($this->commonCiviModules);
221 }
222 }
223
224 /**
225 * Run hooks.
226 *
227 * @param array $civiModules
228 * @param string $fnSuffix
229 * @param int $numParams
230 * @param mixed $arg1
231 * @param mixed $arg2
232 * @param mixed $arg3
233 * @param mixed $arg4
234 * @param mixed $arg5
235 * @param mixed $arg6
236 *
237 * @return array|bool
238 * @throws \CRM_Core_Exception
239 */
240 public function runHooks(
241 $civiModules, $fnSuffix, $numParams,
242 &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6
243 ) {
244 // $civiModules is *not* passed by reference because runHooks
245 // must be reentrant. PHP is finicky about running
246 // multiple loops over the same variable. The circumstances
247 // to reproduce the issue are pretty intricate.
248 $result = [];
249
250 $fnNames = $this->cache->get($fnSuffix);
251 if (!is_array($fnNames)) {
252 $fnNames = [];
253 if ($civiModules !== NULL) {
254 foreach ($civiModules as $module) {
255 $fnName = "{$module}_{$fnSuffix}";
256 if (function_exists($fnName)) {
257 $fnNames[] = $fnName;
258 }
259 }
260 $this->cache->set($fnSuffix, $fnNames);
261 }
262 }
263
264 foreach ($fnNames as $fnName) {
265 $fResult = [];
266 switch ($numParams) {
267 case 0:
268 $fResult = $fnName();
269 break;
270
271 case 1:
272 $fResult = $fnName($arg1);
273 break;
274
275 case 2:
276 $fResult = $fnName($arg1, $arg2);
277 break;
278
279 case 3:
280 $fResult = $fnName($arg1, $arg2, $arg3);
281 break;
282
283 case 4:
284 $fResult = $fnName($arg1, $arg2, $arg3, $arg4);
285 break;
286
287 case 5:
288 $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5);
289 break;
290
291 case 6:
292 $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
293 break;
294
295 default:
296 throw new CRM_Core_Exception(ts('Invalid hook invocation'));
297 }
298
299 if (!empty($fResult) &&
300 is_array($fResult)
301 ) {
302 $result = array_merge($result, $fResult);
303 }
304 }
305
306 return empty($result) ? TRUE : $result;
307 }
308
309 /**
310 * @param $moduleList
311 */
312 public function requireCiviModules(&$moduleList) {
313 $civiModules = CRM_Core_PseudoConstant::getModuleExtensions();
314 foreach ($civiModules as $civiModule) {
315 if (!file_exists($civiModule['filePath'])) {
316 CRM_Core_Session::setStatus(
317 ts('Error loading module file (%1). Please restore the file or disable the module.',
318 [1 => $civiModule['filePath']]),
319 ts('Warning'), 'error');
320 continue;
321 }
322 include_once $civiModule['filePath'];
323 $moduleList[$civiModule['prefix']] = $civiModule['prefix'];
324 }
325 }
326
327 /**
328 * This hook is called before a db write on some core objects.
329 * This hook does not allow the abort of the operation
330 *
331 * @param string $op
332 * The type of operation being performed.
333 * @param string $objectName
334 * The name of the object.
335 * @param int $id
336 * The object id if available.
337 * @param array $params
338 * The parameters used for object creation / editing.
339 *
340 * @return null
341 * the return value is ignored
342 */
343 public static function pre($op, $objectName, $id, &$params) {
344 $event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
345 \Civi::dispatcher()->dispatch('hook_civicrm_pre', $event);
346 return $event->getReturnValues();
347 }
348
349 /**
350 * This hook is called after a db write on some core objects.
351 *
352 * @param string $op
353 * The type of operation being performed.
354 * @param string $objectName
355 * The name of the object.
356 * @param int $objectId
357 * The unique identifier for the object.
358 * @param object $objectRef
359 * The reference to the object if available.
360 *
361 * @return mixed
362 * based on op. pre-hooks return a boolean or
363 * an error message which aborts the operation
364 */
365 public static function post($op, $objectName, $objectId, &$objectRef = NULL) {
366 $event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
367 \Civi::dispatcher()->dispatch('hook_civicrm_post', $event);
368 return $event->getReturnValues();
369 }
370
371 /**
372 * This hook is equivalent to post(), except that it is guaranteed to run
373 * outside of any SQL transaction. The objectRef is not modifiable.
374 *
375 * This hook is defined for two cases:
376 *
377 * 1. If the original action runs within a transaction, then the hook fires
378 * after the transaction commits.
379 * 2. If the original action runs outside a transaction, then the data was
380 * committed immediately, and we can run the hook immediately.
381 *
382 * @param string $op
383 * The type of operation being performed.
384 * @param string $objectName
385 * The name of the object.
386 * @param int $objectId
387 * The unique identifier for the object.
388 * @param object $objectRef
389 * The reference to the object if available.
390 *
391 * @return mixed
392 * based on op. pre-hooks return a boolean or
393 * an error message which aborts the operation
394 */
395 public static function postCommit($op, $objectName, $objectId, $objectRef = NULL) {
396 $event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
397 \Civi::dispatcher()->dispatch('hook_civicrm_postCommit', $event);
398 return $event->getReturnValues();
399 }
400
401 /**
402 * This hook retrieves links from other modules and injects it into.
403 * the view contact tabs
404 *
405 * @param string $op
406 * The type of operation being performed.
407 * @param string $objectName
408 * The name of the object.
409 * @param int $objectId
410 * The unique identifier for the object.
411 * @param array $links
412 * (optional) the links array (introduced in v3.2).
413 * @param int $mask
414 * (optional) the bitmask to show/hide links.
415 * @param array $values
416 * (optional) the values to fill the links.
417 *
418 * @return null
419 * the return value is ignored
420 */
421 public static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = []) {
422 return self::singleton()->invoke(['op', 'objectName', 'objectId', 'links', 'mask', 'values'], $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links');
423 }
424
425 /**
426 * This hook is invoked during the CiviCRM form preProcess phase.
427 *
428 * @param string $formName
429 * The name of the form.
430 * @param CRM_Core_Form $form
431 * Reference to the form object.
432 *
433 * @return null
434 * the return value is ignored
435 */
436 public static function preProcess($formName, &$form) {
437 return self::singleton()
438 ->invoke(['formName', 'form'], $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess');
439 }
440
441 /**
442 * This hook is invoked when building a CiviCRM form. This hook should also
443 * be used to set the default values of a form element
444 *
445 * @param string $formName
446 * The name of the form.
447 * @param CRM_Core_Form $form
448 * Reference to the form object.
449 *
450 * @return null
451 * the return value is ignored
452 */
453 public static function buildForm($formName, &$form) {
454 return self::singleton()->invoke(['formName', 'form'], $formName, $form,
455 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
456 'civicrm_buildForm'
457 );
458 }
459
460 /**
461 * This hook is invoked when a CiviCRM form is submitted. If the module has injected
462 * any form elements, this hook should save the values in the database
463 *
464 * @param string $formName
465 * The name of the form.
466 * @param CRM_Core_Form $form
467 * Reference to the form object.
468 *
469 * @return null
470 * the return value is ignored
471 */
472 public static function postProcess($formName, &$form) {
473 return self::singleton()->invoke(['formName', 'form'], $formName, $form,
474 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
475 'civicrm_postProcess'
476 );
477 }
478
479 /**
480 * This hook is invoked during all CiviCRM form validation. An array of errors
481 * detected is returned. Else we assume validation succeeded.
482 *
483 * @param string $formName
484 * The name of the form.
485 * @param array &$fields the POST parameters as filtered by QF
486 * @param array &$files the FILES parameters as sent in by POST
487 * @param array &$form the form object
488 * @param array &$errors the array of errors.
489 *
490 * @return mixed
491 * formRule hooks return a boolean or
492 * an array of error messages which display a QF Error
493 */
494 public static function validateForm($formName, &$fields, &$files, &$form, &$errors) {
495 return self::singleton()
496 ->invoke(['formName', 'fields', 'files', 'form', 'errors'],
497 $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm');
498 }
499
500 /**
501 * This hook is called after a db write on a custom table.
502 *
503 * @param string $op
504 * The type of operation being performed.
505 * @param string $groupID
506 * The custom group ID.
507 * @param object $entityID
508 * The entityID of the row in the custom table.
509 * @param array $params
510 * The parameters that were sent into the calling function.
511 *
512 * @return null
513 * the return value is ignored
514 */
515 public static function custom($op, $groupID, $entityID, &$params) {
516 return self::singleton()
517 ->invoke(['op', 'groupID', 'entityID', 'params'], $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom');
518 }
519
520 /**
521 * This hook is called before a db write on a custom table.
522 *
523 * @param string $op
524 * The type of operation being performed.
525 * @param string $groupID
526 * The custom group ID.
527 * @param object $entityID
528 * The entityID of the row in the custom table.
529 * @param array $params
530 * The parameters that were sent into the calling function.
531 *
532 * @return null
533 * the return value is ignored
534 */
535 public static function customPre($op, $groupID, $entityID, &$params) {
536 return self::singleton()
537 ->invoke(['op', 'groupID', 'entityID', 'params'], $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_customPre');
538 }
539
540 /**
541 * This hook is called when composing the ACL where clause to restrict
542 * visibility of contacts to the logged in user
543 *
544 * @param int $type
545 * The type of permission needed.
546 * @param array $tables
547 * (reference ) add the tables that are needed for the select clause.
548 * @param array $whereTables
549 * (reference ) add the tables that are needed for the where clause.
550 * @param int $contactID
551 * The contactID for whom the check is made.
552 * @param string $where
553 * The currrent where clause.
554 *
555 * @return null
556 * the return value is ignored
557 */
558 public static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) {
559 return self::singleton()
560 ->invoke(['type', 'tables', 'whereTables', 'contactID', 'where'], $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause');
561 }
562
563 /**
564 * This hook is called when composing the ACL where clause to restrict
565 * visibility of contacts to the logged in user
566 *
567 * @param int $type
568 * The type of permission needed.
569 * @param int $contactID
570 * The contactID for whom the check is made.
571 * @param string $tableName
572 * The tableName which is being permissioned.
573 * @param array $allGroups
574 * The set of all the objects for the above table.
575 * @param array $currentGroups
576 * The set of objects that are currently permissioned for this contact.
577 *
578 * @return null
579 * the return value is ignored
580 */
581 public static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
582 return self::singleton()
583 ->invoke(['type', 'contactID', 'tableName', 'allGroups', 'currentGroups'], $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
584 }
585
586 /**
587 * @param string|CRM_Core_DAO $entity
588 * @param array $clauses
589 * @return mixed
590 */
591 public static function selectWhereClause($entity, &$clauses) {
592 $entityName = is_object($entity) ? _civicrm_api_get_entity_name_from_dao($entity) : $entity;
593 return self::singleton()->invoke(['entity', 'clauses'], $entityName, $clauses,
594 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
595 'civicrm_selectWhereClause'
596 );
597 }
598
599 /**
600 * This hook is called when building the menu table.
601 *
602 * @param array $files
603 * The current set of files to process.
604 *
605 * @return null
606 * the return value is ignored
607 */
608 public static function xmlMenu(&$files) {
609 return self::singleton()->invoke(['files'], $files,
610 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
611 'civicrm_xmlMenu'
612 );
613 }
614
615 /**
616 * (Experimental) This hook is called when build the menu table.
617 *
618 * @param array $items
619 * List of records to include in menu table.
620 * @return null
621 * the return value is ignored
622 */
623 public static function alterMenu(&$items) {
624 return self::singleton()->invoke(['items'], $items,
625 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
626 'civicrm_alterMenu'
627 );
628 }
629
630 /**
631 * A theme is a set of CSS files which are loaded on CiviCRM pages. To register a new
632 * theme, add it to the $themes array. Use these properties:
633 *
634 * - ext: string (required)
635 * The full name of the extension which defines the theme.
636 * Ex: "org.civicrm.themes.greenwich".
637 * - title: string (required)
638 * Visible title.
639 * - help: string (optional)
640 * Description of the theme's appearance.
641 * - url_callback: mixed (optional)
642 * A function ($themes, $themeKey, $cssExt, $cssFile) which returns the URL(s) for a CSS resource.
643 * Returns either an array of URLs or PASSTHRU.
644 * Ex: \Civi\Core\Themes\Resolvers::simple (default)
645 * Ex: \Civi\Core\Themes\Resolvers::none
646 * - prefix: string (optional)
647 * A prefix within the extension folder to prepend to the file name.
648 * - search_order: array (optional)
649 * A list of themes to search.
650 * Generally, the last theme should be "*fallback*" (Civi\Core\Themes::FALLBACK).
651 * - excludes: array (optional)
652 * A list of files (eg "civicrm:css/bootstrap.css" or "$ext:$file") which should never
653 * be returned (they are excluded from display).
654 *
655 * @param array $themes
656 * List of themes, keyed by name.
657 * @return null
658 * the return value is ignored
659 */
660 public static function themes(&$themes) {
661 return self::singleton()->invoke(['themes'], $themes,
662 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
663 'civicrm_themes'
664 );
665 }
666
667 /**
668 * The activeTheme hook determines which theme is active.
669 *
670 * @param string $theme
671 * The identifier for the theme. Alterable.
672 * Ex: 'greenwich'.
673 * @param array $context
674 * Information about the current page-request. Includes some mix of:
675 * - page: the relative path of the current Civi page (Ex: 'civicrm/dashboard').
676 * - themes: an instance of the Civi\Core\Themes service.
677 * @return null
678 * the return value is ignored
679 */
680 public static function activeTheme(&$theme, $context) {
681 return self::singleton()->invoke(array('theme', 'context'), $theme, $context,
682 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
683 'civicrm_activeTheme'
684 );
685 }
686
687 /**
688 * This hook is called for declaring managed entities via API.
689 *
690 * @param array $entities
691 * List of pending entities. Each entity is an array with keys:
692 * + 'module': string; for module-extensions, this is the fully-qualifed name (e.g. "com.example.mymodule"); for CMS modules, the name is prefixed by the CMS (e.g. "drupal.mymodule")
693 * + 'name': string, a symbolic name which can be used to track this entity (Note: Each module creates its own namespace)
694 * + 'entity': string, an entity-type supported by the CiviCRM API (Note: this currently must be an entity which supports the 'is_active' property)
695 * + 'params': array, the entity data as supported by the CiviCRM API
696 * + 'update' (v4.5+): string, a policy which describes when to update records
697 * - 'always' (default): always update the managed-entity record; changes in $entities will override any local changes (eg by the site-admin)
698 * - 'never': never update the managed-entity record; changes made locally (eg by the site-admin) will override changes in $entities
699 * + 'cleanup' (v4.5+): string, a policy which describes whether to cleanup the record when it becomes orphaned (ie when $entities no longer references the record)
700 * - 'always' (default): always delete orphaned records
701 * - 'never': never delete orphaned records
702 * - 'unused': only delete orphaned records if there are no other references to it in the DB. (This is determined by calling the API's "getrefcount" action.)
703 *
704 * @return null
705 * the return value is ignored
706 */
707 public static function managed(&$entities) {
708 return self::singleton()->invoke(['entities'], $entities,
709 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
710 'civicrm_managed'
711 );
712 }
713
714 /**
715 * This hook is called when rendering the dashboard (q=civicrm/dashboard)
716 *
717 * @param int $contactID
718 * The contactID for whom the dashboard is being rendered.
719 * @param int $contentPlacement
720 * (output parameter) where should the hook content be displayed.
721 * relative to the activity list
722 *
723 * @return string
724 * the html snippet to include in the dashboard
725 */
726 public static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) {
727 $retval = self::singleton()->invoke(['contactID', 'contentPlacement'], $contactID, $contentPlacement,
728 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
729 'civicrm_dashboard'
730 );
731
732 /*
733 * Note we need this seemingly unnecessary code because in the event that the implementation
734 * of the hook declares the second parameter but doesn't set it, then it comes back unset even
735 * though we have a default value in this function's declaration above.
736 */
737 if (!isset($contentPlacement)) {
738 $contentPlacement = self::DASHBOARD_BELOW;
739 }
740
741 return $retval;
742 }
743
744 /**
745 * This hook is called before storing recently viewed items.
746 *
747 * @param array $recentArray
748 * An array of recently viewed or processed items, for in place modification.
749 *
750 * @return array
751 */
752 public static function recent(&$recentArray) {
753 return self::singleton()->invoke(['recentArray'], $recentArray,
754 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
755 'civicrm_recent'
756 );
757 }
758
759 /**
760 * Determine how many other records refer to a given record.
761 *
762 * @param CRM_Core_DAO $dao
763 * The item for which we want a reference count.
764 * @param array $refCounts
765 * Each item in the array is an Array with keys:
766 * - name: string, eg "sql:civicrm_email:contact_id"
767 * - type: string, eg "sql"
768 * - count: int, eg "5" if there are 5 email addresses that refer to $dao
769 *
770 * @return mixed
771 * Return is not really intended to be used.
772 */
773 public static function referenceCounts($dao, &$refCounts) {
774 return self::singleton()->invoke(['dao', 'refCounts'], $dao, $refCounts,
775 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
776 'civicrm_referenceCounts'
777 );
778 }
779
780 /**
781 * This hook is called when building the amount structure for a Contribution or Event Page.
782 *
783 * @param int $pageType
784 * Is this a contribution or event page.
785 * @param CRM_Core_Form $form
786 * Reference to the form object.
787 * @param array $amount
788 * The amount structure to be displayed.
789 *
790 * @return null
791 */
792 public static function buildAmount($pageType, &$form, &$amount) {
793 return self::singleton()->invoke(['pageType', 'form', 'amount'], $pageType, $form, $amount, self::$_nullObject,
794 self::$_nullObject, self::$_nullObject, 'civicrm_buildAmount');
795 }
796
797 /**
798 * This hook is called when building the state list for a particular country.
799 *
800 * @param array $countryID
801 * The country id whose states are being selected.
802 * @param $states
803 *
804 * @return null
805 */
806 public static function buildStateProvinceForCountry($countryID, &$states) {
807 return self::singleton()->invoke(['countryID', 'states'], $countryID, $states,
808 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
809 'civicrm_buildStateProvinceForCountry'
810 );
811 }
812
813 /**
814 * This hook is called when rendering the tabs for a contact (q=civicrm/contact/view)c
815 *
816 * @param array $tabs
817 * The array of tabs that will be displayed.
818 * @param int $contactID
819 * The contactID for whom the dashboard is being rendered.
820 *
821 * @return null
822 * @deprecated Use tabset() instead.
823 */
824 public static function tabs(&$tabs, $contactID) {
825 return self::singleton()->invoke(['tabs', 'contactID'], $tabs, $contactID,
826 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabs'
827 );
828 }
829
830 /**
831 * This hook is called when rendering the tabs used for events and potentially
832 * contribution pages, etc.
833 *
834 * @param string $tabsetName
835 * Name of the screen or visual element.
836 * @param array $tabs
837 * Tabs that will be displayed.
838 * @param array $context
839 * Extra data about the screen or context in which the tab is used.
840 *
841 * @return null
842 */
843 public static function tabset($tabsetName, &$tabs, $context) {
844 return self::singleton()->invoke(['tabsetName', 'tabs', 'context'], $tabsetName, $tabs,
845 $context, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabset'
846 );
847 }
848
849 /**
850 * This hook is called when sending an email / printing labels
851 *
852 * @param array $tokens
853 * The list of tokens that can be used for the contact.
854 *
855 * @return null
856 */
857 public static function tokens(&$tokens) {
858 return self::singleton()->invoke(['tokens'], $tokens,
859 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tokens'
860 );
861 }
862
863 /**
864 * This hook allows modification of the admin panels
865 *
866 * @param array $panels
867 * Associated array of admin panels
868 *
869 * @return mixed
870 */
871 public static function alterAdminPanel(&$panels) {
872 return self::singleton()->invoke(array('panels'), $panels,
873 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
874 'civicrm_alterAdminPanel'
875 );
876 }
877
878 /**
879 * This hook is called when sending an email / printing labels to get the values for all the
880 * tokens returned by the 'tokens' hook
881 *
882 * @param array $details
883 * The array to store the token values indexed by contactIDs.
884 * @param array $contactIDs
885 * An array of contactIDs.
886 * @param int $jobID
887 * The jobID if this is associated with a CiviMail mailing.
888 * @param array $tokens
889 * The list of tokens associated with the content.
890 * @param string $className
891 * The top level className from where the hook is invoked.
892 *
893 * @return null
894 */
895 public static function tokenValues(
896 &$details,
897 $contactIDs,
898 $jobID = NULL,
899 $tokens = [],
900 $className = NULL
901 ) {
902 return self::singleton()
903 ->invoke(['details', 'contactIDs', 'jobID', 'tokens', 'className'], $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues');
904 }
905
906 /**
907 * This hook is called before a CiviCRM Page is rendered. You can use this hook to insert smarty variables
908 * in a template
909 *
910 * @param object $page
911 * The page that will be rendered.
912 *
913 * @return null
914 */
915 public static function pageRun(&$page) {
916 return self::singleton()->invoke(['page'], $page,
917 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
918 'civicrm_pageRun'
919 );
920 }
921
922 /**
923 * This hook is called after a copy of an object has been made. The current objects are
924 * Event, Contribution Page and UFGroup
925 *
926 * @param string $objectName
927 * Name of the object.
928 * @param object $object
929 * Reference to the copy.
930 *
931 * @return null
932 */
933 public static function copy($objectName, &$object) {
934 return self::singleton()->invoke(['objectName', 'object'], $objectName, $object,
935 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
936 'civicrm_copy'
937 );
938 }
939
940 /**
941 * This hook is called when a contact unsubscribes from a mailing. It allows modules
942 * to override what the contacts are removed from.
943 *
944 * @param string $op
945 * Ignored for now
946 * @param int $mailingId
947 * The id of the mailing to unsub from
948 * @param int $contactId
949 * The id of the contact who is unsubscribing
950 * @param array|int $groups
951 * Groups the contact will be removed from.
952 * @param array|int $baseGroups
953 * Base groups (used in smart mailings) the contact will be removed from.
954 *
955 *
956 * @return mixed
957 */
958 public static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) {
959 return self::singleton()
960 ->invoke(['op', 'mailingId', 'contactId', 'groups', 'baseGroups'], $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups');
961 }
962
963 /**
964 * This hook is called when CiviCRM needs to edit/display a custom field with options
965 *
966 * @deprecated in favor of hook_civicrm_fieldOptions
967 *
968 * @param int $customFieldID
969 * The custom field ID.
970 * @param array $options
971 * The current set of options for that custom field.
972 * You can add/remove existing options.
973 * Important: This array may contain meta-data about the field that is needed elsewhere, so it is important
974 * to be careful to not overwrite the array.
975 * Only add/edit/remove the specific field options you intend to affect.
976 * @param bool $detailedFormat
977 * If true, the options are in an ID => array ( 'id' => ID, 'label' => label, 'value' => value ) format
978 * @param array $selectAttributes
979 * Contain select attribute(s) if any.
980 *
981 * @return mixed
982 */
983 public static function customFieldOptions($customFieldID, &$options, $detailedFormat = FALSE, $selectAttributes = []) {
984 // Weird: $selectAttributes is inputted but not outputted.
985 return self::singleton()->invoke(['customFieldID', 'options', 'detailedFormat'], $customFieldID, $options, $detailedFormat,
986 self::$_nullObject, self::$_nullObject, self::$_nullObject,
987 'civicrm_customFieldOptions'
988 );
989 }
990
991 /**
992 * Hook for modifying field options
993 *
994 * @param string $entity
995 * @param string $field
996 * @param array $options
997 * @param array $params
998 *
999 * @return mixed
1000 */
1001 public static function fieldOptions($entity, $field, &$options, $params) {
1002 return self::singleton()->invoke(['entity', 'field', 'options', 'params'], $entity, $field, $options, $params,
1003 self::$_nullObject, self::$_nullObject,
1004 'civicrm_fieldOptions'
1005 );
1006 }
1007
1008 /**
1009 *
1010 * This hook is called to display the list of actions allowed after doing a search.
1011 * This allows the module developer to inject additional actions or to remove existing actions.
1012 *
1013 * @param string $objectType
1014 * The object type for this search.
1015 * - activity, campaign, case, contact, contribution, event, grant, membership, and pledge are supported.
1016 * @param array $tasks
1017 * The current set of tasks for that custom field.
1018 * You can add/remove existing tasks.
1019 * Each task needs to have a title (eg 'title' => ts( 'Group - add contacts')) and a class
1020 * (eg 'class' => 'CRM_Contact_Form_Task_AddToGroup').
1021 * Optional result (boolean) may also be provided. Class can be an array of classes (not sure what that does :( ).
1022 * The key for new Task(s) should not conflict with the keys for core tasks of that $objectType, which can be
1023 * found in CRM/$objectType/Task.php.
1024 *
1025 * @return mixed
1026 */
1027 public static function searchTasks($objectType, &$tasks) {
1028 return self::singleton()->invoke(['objectType', 'tasks'], $objectType, $tasks,
1029 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1030 'civicrm_searchTasks'
1031 );
1032 }
1033
1034 /**
1035 * @param mixed $form
1036 * @param array $params
1037 *
1038 * @return mixed
1039 */
1040 public static function eventDiscount(&$form, &$params) {
1041 return self::singleton()->invoke(['form', 'params'], $form, $params,
1042 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1043 'civicrm_eventDiscount'
1044 );
1045 }
1046
1047 /**
1048 * This hook is called when composing a mailing. You can include / exclude other groups as needed.
1049 *
1050 * @param mixed $form
1051 * The form object for which groups / mailings being displayed
1052 * @param array $groups
1053 * The list of groups being included / excluded
1054 * @param array $mailings
1055 * The list of mailings being included / excluded
1056 *
1057 * @return mixed
1058 */
1059 public static function mailingGroups(&$form, &$groups, &$mailings) {
1060 return self::singleton()->invoke(['form', 'groups', 'mailings'], $form, $groups, $mailings,
1061 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1062 'civicrm_mailingGroups'
1063 );
1064 }
1065
1066 /**
1067 * (Experimental) Modify the list of template-types used for CiviMail composition.
1068 *
1069 * @param array $types
1070 * Sequentially indexed list of template types. Each type specifies:
1071 * - name: string
1072 * - editorUrl: string, Angular template URL
1073 * - weight: int, priority when picking a default value for new mailings
1074 * @return mixed
1075 */
1076 public static function mailingTemplateTypes(&$types) {
1077 return self::singleton()->invoke(['types'], $types, self::$_nullObject, self::$_nullObject,
1078 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1079 'civicrm_mailingTemplateTypes'
1080 );
1081 }
1082
1083 /**
1084 * This hook is called when composing the array of membershipTypes and their cost during a membership registration
1085 * (new or renewal).
1086 * Note the hook is called on initial page load and also reloaded after submit (PRG pattern).
1087 * You can use it to alter the membership types when first loaded, or after submission
1088 * (for example if you want to gather data in the form and use it to alter the fees).
1089 *
1090 * @param mixed $form
1091 * The form object that is presenting the page
1092 * @param array $membershipTypes
1093 * The array of membership types and their amount
1094 *
1095 * @return mixed
1096 */
1097 public static function membershipTypeValues(&$form, &$membershipTypes) {
1098 return self::singleton()->invoke(['form', 'membershipTypes'], $form, $membershipTypes,
1099 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1100 'civicrm_membershipTypeValues'
1101 );
1102 }
1103
1104 /**
1105 * This hook is called when rendering the contact summary.
1106 *
1107 * @param int $contactID
1108 * The contactID for whom the summary is being rendered
1109 * @param mixed $content
1110 * @param int $contentPlacement
1111 * Specifies where the hook content should be displayed relative to the
1112 * existing content
1113 *
1114 * @return string
1115 * The html snippet to include in the contact summary
1116 */
1117 public static function summary($contactID, &$content, &$contentPlacement = self::SUMMARY_BELOW) {
1118 return self::singleton()->invoke(['contactID', 'content', 'contentPlacement'], $contactID, $content, $contentPlacement,
1119 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1120 'civicrm_summary'
1121 );
1122 }
1123
1124 /**
1125 * Use this hook to populate the list of contacts returned by Contact Reference custom fields.
1126 * By default, Contact Reference fields will search on and return all CiviCRM contacts.
1127 * If you want to limit the contacts returned to a specific group, or some other criteria
1128 * - you can override that behavior by providing a SQL query that returns some subset of your contacts.
1129 * The hook is called when the query is executed to get the list of contacts to display.
1130 *
1131 * @param mixed $query
1132 * - the query that will be executed (input and output parameter);.
1133 * It's important to realize that the ACL clause is built prior to this hook being fired,
1134 * so your query will ignore any ACL rules that may be defined.
1135 * Your query must return two columns:
1136 * the contact 'data' to display in the autocomplete dropdown (usually contact.sort_name - aliased as 'data')
1137 * the contact IDs
1138 * @param string $queryText
1139 * The name string to execute the query against (this is the value being typed in by the user).
1140 * @param string $context
1141 * The context in which this ajax call is being made (for example: 'customfield', 'caseview').
1142 * @param int $id
1143 * The id of the object for which the call is being made.
1144 * For custom fields, it will be the custom field id
1145 *
1146 * @return mixed
1147 */
1148 public static function contactListQuery(&$query, $queryText, $context, $id) {
1149 return self::singleton()->invoke(['query', 'queryText', 'context', 'id'], $query, $queryText, $context, $id,
1150 self::$_nullObject, self::$_nullObject,
1151 'civicrm_contactListQuery'
1152 );
1153 }
1154
1155 /**
1156 * Hook definition for altering payment parameters before talking to a payment processor back end.
1157 *
1158 * Definition will look like this:
1159 *
1160 * function hook_civicrm_alterPaymentProcessorParams(
1161 * $paymentObj,
1162 * &$rawParams,
1163 * &$cookedParams
1164 * );
1165 *
1166 * @param CRM_Core_Payment $paymentObj
1167 * Instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy')
1168 * See discussion in CRM-16224 as to whether $paymentObj should be passed by reference.
1169 * @param array &$rawParams
1170 * array of params as passed to to the processor
1171 * @param array|\Civi\Payment\PropertyBag &$cookedParams
1172 * params after the processor code has translated them into its own key/value pairs
1173 *
1174 * @return mixed
1175 * This return is not really intended to be used.
1176 */
1177 public static function alterPaymentProcessorParams(
1178 $paymentObj,
1179 &$rawParams,
1180 &$cookedParams
1181 ) {
1182 return self::singleton()->invoke(['paymentObj', 'rawParams', 'cookedParams'], $paymentObj, $rawParams, $cookedParams,
1183 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1184 'civicrm_alterPaymentProcessorParams'
1185 );
1186 }
1187
1188 /**
1189 * This hook is called when an email is about to be sent by CiviCRM.
1190 *
1191 * @param array $params
1192 * Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html,
1193 * returnPath, replyTo, headers, attachments (array)
1194 * @param string $context
1195 * The context in which the hook is being invoked, eg 'civimail'.
1196 *
1197 * @return mixed
1198 */
1199 public static function alterMailParams(&$params, $context = NULL) {
1200 return self::singleton()->invoke(['params', 'context'], $params, $context,
1201 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1202 'civicrm_alterMailParams'
1203 );
1204 }
1205
1206 /**
1207 * This hook is called when membership status is being calculated.
1208 *
1209 * @param array $membershipStatus
1210 * Membership status details as determined - alter if required.
1211 * @param array $arguments
1212 * Arguments passed in to calculate date.
1213 * - 'start_date'
1214 * - 'end_date'
1215 * - 'status_date'
1216 * - 'join_date'
1217 * - 'exclude_is_admin'
1218 * - 'membership_type_id'
1219 * @param array $membership
1220 * Membership details from the calling function.
1221 *
1222 * @return mixed
1223 */
1224 public static function alterCalculatedMembershipStatus(&$membershipStatus, $arguments, $membership) {
1225 return self::singleton()->invoke(['membershipStatus', 'arguments', 'membership'], $membershipStatus, $arguments,
1226 $membership, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1227 'civicrm_alterCalculatedMembershipStatus'
1228 );
1229 }
1230
1231 /**
1232 * This hook is called after getting the content of the mail and before tokenizing it.
1233 *
1234 * @param array $content
1235 * Array fields include: html, text, subject
1236 *
1237 * @return mixed
1238 */
1239 public static function alterMailContent(&$content) {
1240 return self::singleton()->invoke(['content'], $content,
1241 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1242 'civicrm_alterMailContent'
1243 );
1244 }
1245
1246 /**
1247 * This hook is called when rendering the Manage Case screen.
1248 *
1249 * @param int $caseID
1250 * The case ID.
1251 *
1252 * @return array
1253 * Array of data to be displayed, where the key is a unique id to be used for styling (div id's)
1254 * and the value is an array with keys 'label' and 'value' specifying label/value pairs
1255 */
1256 public static function caseSummary($caseID) {
1257 return self::singleton()->invoke(['caseID'], $caseID,
1258 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1259 'civicrm_caseSummary'
1260 );
1261 }
1262
1263 /**
1264 * This hook is called when locating CiviCase types.
1265 *
1266 * @param array $caseTypes
1267 *
1268 * @return mixed
1269 */
1270 public static function caseTypes(&$caseTypes) {
1271 return self::singleton()
1272 ->invoke(['caseTypes'], $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes');
1273 }
1274
1275 /**
1276 * This hook is called soon after the CRM_Core_Config object has ben initialized.
1277 * You can use this hook to modify the config object and hence behavior of CiviCRM dynamically.
1278 *
1279 * @param CRM_Core_Config|array $config
1280 * The config object
1281 *
1282 * @return mixed
1283 */
1284 public static function config(&$config) {
1285 return self::singleton()->invoke(['config'], $config,
1286 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1287 'civicrm_config'
1288 );
1289 }
1290
1291 /**
1292 * This hooks allows to change option values.
1293 *
1294 * @deprecated in favor of hook_civicrm_fieldOptions
1295 *
1296 * @param array $options
1297 * Associated array of option values / id
1298 * @param string $groupName
1299 * Option group name
1300 *
1301 * @return mixed
1302 */
1303 public static function optionValues(&$options, $groupName) {
1304 return self::singleton()->invoke(['options', 'groupName'], $options, $groupName,
1305 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1306 'civicrm_optionValues'
1307 );
1308 }
1309
1310 /**
1311 * This hook allows modification of the navigation menu.
1312 *
1313 * @param array $params
1314 * Associated array of navigation menu entry to Modify/Add
1315 *
1316 * @return mixed
1317 */
1318 public static function navigationMenu(&$params) {
1319 return self::singleton()->invoke(['params'], $params,
1320 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1321 'civicrm_navigationMenu'
1322 );
1323 }
1324
1325 /**
1326 * This hook allows modification of the data used to perform merging of duplicates.
1327 *
1328 * @param string $type
1329 * The type of data being passed (cidRefs|eidRefs|relTables|sqls).
1330 * @param array $data
1331 * The data, as described in $type.
1332 * @param int $mainId
1333 * Contact_id of the contact that survives the merge.
1334 * @param int $otherId
1335 * Contact_id of the contact that will be absorbed and deleted.
1336 * @param array $tables
1337 * When $type is "sqls", an array of tables as it may have been handed to the calling function.
1338 *
1339 * @return mixed
1340 */
1341 public static function merge($type, &$data, $mainId = NULL, $otherId = NULL, $tables = NULL) {
1342 return self::singleton()->invoke(['type', 'data', 'mainId', 'otherId', 'tables'], $type, $data, $mainId, $otherId, $tables, self::$_nullObject, 'civicrm_merge');
1343 }
1344
1345 /**
1346 * This hook allows modification of the data calculated for merging locations.
1347 *
1348 * @param array $blocksDAO
1349 * Array of location DAO to be saved. These are arrays in 2 keys 'update' & 'delete'.
1350 * @param int $mainId
1351 * Contact_id of the contact that survives the merge.
1352 * @param int $otherId
1353 * Contact_id of the contact that will be absorbed and deleted.
1354 * @param array $migrationInfo
1355 * Calculated migration info, informational only.
1356 *
1357 * @return mixed
1358 */
1359 public static function alterLocationMergeData(&$blocksDAO, $mainId, $otherId, $migrationInfo) {
1360 return self::singleton()->invoke(['blocksDAO', 'mainId', 'otherId', 'migrationInfo'], $blocksDAO, $mainId, $otherId, $migrationInfo, self::$_nullObject, self::$_nullObject, 'civicrm_alterLocationMergeData');
1361 }
1362
1363 /**
1364 * This hook provides a way to override the default privacy behavior for notes.
1365 *
1366 * @param array &$noteValues
1367 * Associative array of values for this note
1368 *
1369 * @return mixed
1370 */
1371 public static function notePrivacy(&$noteValues) {
1372 return self::singleton()->invoke(['noteValues'], $noteValues,
1373 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1374 'civicrm_notePrivacy'
1375 );
1376 }
1377
1378 /**
1379 * This hook is called before record is exported as CSV.
1380 *
1381 * @param string $exportTempTable
1382 * Name of the temporary export table used during export.
1383 * @param array $headerRows
1384 * Header rows for output.
1385 * @param array $sqlColumns
1386 * SQL columns.
1387 * @param int $exportMode
1388 * Export mode ( contact, contribution, etc...).
1389 * @param string $componentTable
1390 * Name of temporary table
1391 * @param array $ids
1392 * Array of object's ids
1393 *
1394 * @return mixed
1395 */
1396 public static function export(&$exportTempTable, &$headerRows, &$sqlColumns, $exportMode, $componentTable, $ids) {
1397 return self::singleton()->invoke(['exportTempTable', 'headerRows', 'sqlColumns', 'exportMode', 'componentTable', 'ids'],
1398 $exportTempTable, $headerRows, $sqlColumns,
1399 $exportMode, $componentTable, $ids,
1400 'civicrm_export'
1401 );
1402 }
1403
1404 /**
1405 * This hook allows modification of the queries constructed from dupe rules.
1406 *
1407 * @param string $obj
1408 * Object of rulegroup class.
1409 * @param string $type
1410 * Type of queries e.g table / threshold.
1411 * @param array $query
1412 * Set of queries.
1413 *
1414 * @return mixed
1415 */
1416 public static function dupeQuery($obj, $type, &$query) {
1417 return self::singleton()->invoke(['obj', 'type', 'query'], $obj, $type, $query,
1418 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1419 'civicrm_dupeQuery'
1420 );
1421 }
1422
1423 /**
1424 * Check for duplicate contacts
1425 *
1426 * @param array $dedupeParams
1427 * Array of params for finding duplicates: [
1428 * '{parameters returned by CRM_Dedupe_Finder::formatParams}
1429 * 'check_permission' => TRUE/FALSE;
1430 * 'contact_type' => $contactType;
1431 * 'rule' = $rule;
1432 * 'rule_group_id' => $ruleGroupID;
1433 * 'excludedContactIDs' => $excludedContactIDs;
1434 * @param array $dedupeResults
1435 * Array of results ['handled' => TRUE/FALSE, 'ids' => array of IDs of duplicate contacts]
1436 * @param array $contextParams
1437 * The context if relevant, eg. ['event_id' => X]
1438 *
1439 * @return mixed
1440 */
1441 public static function findDuplicates($dedupeParams, &$dedupeResults, $contextParams) {
1442 return self::singleton()
1443 ->invoke(['dedupeParams', 'dedupeResults', 'contextParams'], $dedupeParams, $dedupeResults, $contextParams, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_findDuplicates');
1444 }
1445
1446 /**
1447 * This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php
1448 *
1449 * @param string $type
1450 * Type of mail processed: 'activity' OR 'mailing'.
1451 * @param array &$params the params that were sent to the CiviCRM API function
1452 * @param object $mail
1453 * The mail object which is an ezcMail class.
1454 * @param array &$result the result returned by the api call
1455 * @param string $action
1456 * (optional ) the requested action to be performed if the types was 'mailing'.
1457 *
1458 * @return mixed
1459 */
1460 public static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) {
1461 return self::singleton()
1462 ->invoke(['type', 'params', 'mail', 'result', 'action'], $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor');
1463 }
1464
1465 /**
1466 * This hook is called after a row has been processed and the
1467 * record (and associated records imported
1468 *
1469 * @param string $object
1470 * Object being imported (for now Contact only, later Contribution, Activity,.
1471 * Participant and Member)
1472 * @param string $usage
1473 * Hook usage/location (for now process only, later mapping and others).
1474 * @param string $objectRef
1475 * Import record object.
1476 * @param array $params
1477 * Array with various key values: currently.
1478 * contactID - contact id
1479 * importID - row id in temp table
1480 * importTempTable - name of tempTable
1481 * fieldHeaders - field headers
1482 * fields - import fields
1483 *
1484 * @return mixed
1485 */
1486 public static function import($object, $usage, &$objectRef, &$params) {
1487 return self::singleton()->invoke(['object', 'usage', 'objectRef', 'params'], $object, $usage, $objectRef, $params,
1488 self::$_nullObject, self::$_nullObject,
1489 'civicrm_import'
1490 );
1491 }
1492
1493 /**
1494 * This hook is called when API permissions are checked (cf. civicrm_api3_api_check_permission()
1495 * in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/permissions.php).
1496 *
1497 * @param string $entity
1498 * The API entity (like contact).
1499 * @param string $action
1500 * The API action (like get).
1501 * @param array &$params the API parameters
1502 * @param array &$permissions the associative permissions array (probably to be altered by this hook)
1503 *
1504 * @return mixed
1505 */
1506 public static function alterAPIPermissions($entity, $action, &$params, &$permissions) {
1507 return self::singleton()->invoke(['entity', 'action', 'params', 'permissions'], $entity, $action, $params, $permissions,
1508 self::$_nullObject, self::$_nullObject,
1509 'civicrm_alterAPIPermissions'
1510 );
1511 }
1512
1513 /**
1514 * @param CRM_Core_DAO $dao
1515 *
1516 * @return mixed
1517 */
1518 public static function postSave(&$dao) {
1519 $hookName = 'civicrm_postSave_' . $dao->getTableName();
1520 return self::singleton()->invoke(['dao'], $dao,
1521 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1522 $hookName
1523 );
1524 }
1525
1526 /**
1527 * This hook allows user to customize context menu Actions on contact summary page.
1528 *
1529 * @param array $actions
1530 * Array of all Actions in contextmenu.
1531 * @param int $contactID
1532 * ContactID for the summary page.
1533 *
1534 * @return mixed
1535 */
1536 public static function summaryActions(&$actions, $contactID = NULL) {
1537 return self::singleton()->invoke(['actions', 'contactID'], $actions, $contactID,
1538 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1539 'civicrm_summaryActions'
1540 );
1541 }
1542
1543 /**
1544 * This hook is called from CRM_Core_Selector_Controller through which all searches in civicrm go.
1545 * This enables us hook implementors to modify both the headers and the rows
1546 *
1547 * The BIGGEST drawback with this hook is that you may need to modify the result template to include your
1548 * fields. The result files are CRM/{Contact,Contribute,Member,Event...}/Form/Selector.tpl
1549 *
1550 * However, if you use the same number of columns, you can overwrite the existing columns with the values that
1551 * you want displayed. This is a hackish, but avoids template modification.
1552 *
1553 * @param string $objectName
1554 * The component name that we are doing the search.
1555 * activity, campaign, case, contact, contribution, event, grant, membership, and pledge
1556 * @param array &$headers the list of column headers, an associative array with keys: ( name, sort, order )
1557 * @param array &$rows the list of values, an associate array with fields that are displayed for that component
1558 * @param array $selector
1559 * the selector object. Allows you access to the context of the search
1560 *
1561 * @return mixed
1562 * modify the header and values object to pass the data you need
1563 */
1564 public static function searchColumns($objectName, &$headers, &$rows, &$selector) {
1565 return self::singleton()->invoke(['objectName', 'headers', 'rows', 'selector'], $objectName, $headers, $rows, $selector,
1566 self::$_nullObject, self::$_nullObject,
1567 'civicrm_searchColumns'
1568 );
1569 }
1570
1571 /**
1572 * This hook is called when uf groups are being built for a module.
1573 *
1574 * @param string $moduleName
1575 * Module name.
1576 * @param array $ufGroups
1577 * Array of ufgroups for a module.
1578 *
1579 * @return null
1580 */
1581 public static function buildUFGroupsForModule($moduleName, &$ufGroups) {
1582 return self::singleton()->invoke(['moduleName', 'ufGroups'], $moduleName, $ufGroups,
1583 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1584 'civicrm_buildUFGroupsForModule'
1585 );
1586 }
1587
1588 /**
1589 * This hook is called when we are determining the contactID for a specific
1590 * email address
1591 *
1592 * @param string $email
1593 * The email address.
1594 * @param int $contactID
1595 * The contactID that matches this email address, IF it exists.
1596 * @param array $result
1597 * (reference) has two fields.
1598 * contactID - the new (or same) contactID
1599 * action - 3 possible values:
1600 * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_CREATE_INDIVIDUAL - create a new contact record
1601 * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_OVERRIDE - use the new contactID
1602 * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_IGNORE - skip this email address
1603 *
1604 * @return null
1605 */
1606 public static function emailProcessorContact($email, $contactID, &$result) {
1607 return self::singleton()->invoke(['email', 'contactID', 'result'], $email, $contactID, $result,
1608 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1609 'civicrm_emailProcessorContact'
1610 );
1611 }
1612
1613 /**
1614 * Hook definition for altering the generation of Mailing Labels.
1615 *
1616 * @param array $args
1617 * An array of the args in the order defined for the tcpdf multiCell api call.
1618 * with the variable names below converted into string keys (ie $w become 'w'
1619 * as the first key for $args)
1620 * float $w Width of cells. If 0, they extend up to the right margin of the page.
1621 * float $h Cell minimum height. The cell extends automatically if needed.
1622 * string $txt String to print
1623 * mixed $border Indicates if borders must be drawn around the cell block. The value can
1624 * be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or
1625 * a string containing some or all of the following characters (in any order):
1626 * <ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul>
1627 * string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string:
1628 * left align</li><li>C: center</li><li>R: right align</li><li>J: justification
1629 * (default value when $ishtml=false)</li></ul>
1630 * int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
1631 * int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0:
1632 * to the right</li><li>1: to the beginning of the next line [DEFAULT]</li><li>2: below</li></ul>
1633 * float $x x position in user units
1634 * float $y y position in user units
1635 * boolean $reseth if true reset the last cell height (default true).
1636 * int $stretch stretch character mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if
1637 * necessary</li><li>2 = forced horizontal scaling</li><li>3 = character spacing only if
1638 * necessary</li><li>4 = forced character spacing</li></ul>
1639 * boolean $ishtml set to true if $txt is HTML content (default = false).
1640 * boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width.
1641 * float $maxh maximum height. It should be >= $h and less then remaining space to the bottom of the page,
1642 * or 0 for disable this feature. This feature works only when $ishtml=false.
1643 *
1644 * @return mixed
1645 */
1646 public static function alterMailingLabelParams(&$args) {
1647 return self::singleton()->invoke(['args'], $args,
1648 self::$_nullObject, self::$_nullObject,
1649 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1650 'civicrm_alterMailingLabelParams'
1651 );
1652 }
1653
1654 /**
1655 * This hooks allows alteration of generated page content.
1656 *
1657 * @param $content
1658 * Previously generated content.
1659 * @param $context
1660 * Context of content - page or form.
1661 * @param $tplName
1662 * The file name of the tpl.
1663 * @param $object
1664 * A reference to the page or form object.
1665 *
1666 * @return mixed
1667 */
1668 public static function alterContent(&$content, $context, $tplName, &$object) {
1669 return self::singleton()->invoke(['content', 'context', 'tplName', 'object'], $content, $context, $tplName, $object,
1670 self::$_nullObject, self::$_nullObject,
1671 'civicrm_alterContent'
1672 );
1673 }
1674
1675 /**
1676 * This hooks allows alteration of the tpl file used to generate content. It differs from the
1677 * altercontent hook as the content has already been rendered through the tpl at that point
1678 *
1679 * @param $formName
1680 * Previously generated content.
1681 * @param $form
1682 * Reference to the form object.
1683 * @param $context
1684 * Context of content - page or form.
1685 * @param $tplName
1686 * Reference the file name of the tpl.
1687 *
1688 * @return mixed
1689 */
1690 public static function alterTemplateFile($formName, &$form, $context, &$tplName) {
1691 return self::singleton()->invoke(['formName', 'form', 'context', 'tplName'], $formName, $form, $context, $tplName,
1692 self::$_nullObject, self::$_nullObject,
1693 'civicrm_alterTemplateFile'
1694 );
1695 }
1696
1697 /**
1698 * This hook collects the trigger definition from all components.
1699 *
1700 * @param $info
1701 * @param string $tableName
1702 * (optional) the name of the table that we are interested in only.
1703 *
1704 * @internal param \reference $triggerInfo to an array of trigger information
1705 * each element has 4 fields:
1706 * table - array of tableName
1707 * when - BEFORE or AFTER
1708 * event - array of eventName - INSERT OR UPDATE OR DELETE
1709 * sql - array of statements optionally terminated with a ;
1710 * a statement can use the tokes {tableName} and {eventName}
1711 * to do token replacement with the table / event. This allows
1712 * templatizing logging and other hooks
1713 * @return mixed
1714 */
1715 public static function triggerInfo(&$info, $tableName = NULL) {
1716 return self::singleton()->invoke(['info', 'tableName'], $info, $tableName,
1717 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1718 self::$_nullObject,
1719 'civicrm_triggerInfo'
1720 );
1721 }
1722
1723 /**
1724 * This hook allows changes to the spec of which tables to log.
1725 *
1726 * @param array $logTableSpec
1727 *
1728 * @return mixed
1729 */
1730 public static function alterLogTables(&$logTableSpec) {
1731 return self::singleton()->invoke(['logTableSpec'], $logTableSpec, $_nullObject,
1732 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1733 self::$_nullObject,
1734 'civicrm_alterLogTables'
1735 );
1736 }
1737
1738 /**
1739 * This hook is called when a module-extension is installed.
1740 * Each module will receive hook_civicrm_install during its own installation (but not during the
1741 * installation of unrelated modules).
1742 */
1743 public static function install() {
1744 // Actually invoke via CRM_Extension_Manager_Module::callHook
1745 throw new \RuntimeException(sprintf("The method %s::%s is just a documentation stub and should not be invoked directly.", __CLASS__, __FUNCTION__));
1746 }
1747
1748 /**
1749 * This hook is called when a module-extension is uninstalled.
1750 * Each module will receive hook_civicrm_uninstall during its own uninstallation (but not during the
1751 * uninstallation of unrelated modules).
1752 */
1753 public static function uninstall() {
1754 // Actually invoke via CRM_Extension_Manager_Module::callHook
1755 throw new \RuntimeException(sprintf("The method %s::%s is just a documentation stub and should not be invoked directly.", __CLASS__, __FUNCTION__));
1756 }
1757
1758 /**
1759 * This hook is called when a module-extension is re-enabled.
1760 * Each module will receive hook_civicrm_enable during its own re-enablement (but not during the
1761 * re-enablement of unrelated modules).
1762 */
1763 public static function enable() {
1764 // Actually invoke via CRM_Extension_Manager_Module::callHook
1765 throw new \RuntimeException(sprintf("The method %s::%s is just a documentation stub and should not be invoked directly.", __CLASS__, __FUNCTION__));
1766 }
1767
1768 /**
1769 * This hook is called when a module-extension is disabled.
1770 * Each module will receive hook_civicrm_disable during its own disablement (but not during the
1771 * disablement of unrelated modules).
1772 */
1773 public static function disable() {
1774 // Actually invoke via CRM_Extension_Manager_Module::callHook
1775 throw new \RuntimeException(sprintf("The method %s::%s is just a documentation stub and should not be invoked directly.", __CLASS__, __FUNCTION__));
1776 }
1777
1778 /**
1779 * Alter redirect.
1780 *
1781 * This hook is called when the browser is being re-directed and allows the url
1782 * to be altered.
1783 *
1784 * @param \Psr\Http\Message\UriInterface $url
1785 * @param array $context
1786 * Additional information about context
1787 * - output - if this is 'json' then it will return json.
1788 *
1789 * @return null
1790 * the return value is ignored
1791 */
1792 public static function alterRedirect(&$url, &$context) {
1793 return self::singleton()->invoke(['url', 'context'], $url,
1794 $context, self::$_nullObject,
1795 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1796 'civicrm_alterRedirect'
1797 );
1798 }
1799
1800 /**
1801 * @param $varType
1802 * @param $var
1803 * @param $object
1804 *
1805 * @return mixed
1806 */
1807 public static function alterReportVar($varType, &$var, &$object) {
1808 return self::singleton()->invoke(['varType', 'var', 'object'], $varType, $var, $object,
1809 self::$_nullObject,
1810 self::$_nullObject, self::$_nullObject,
1811 'civicrm_alterReportVar'
1812 );
1813 }
1814
1815 /**
1816 * This hook is called to drive database upgrades for extension-modules.
1817 *
1818 * @param string $op
1819 * The type of operation being performed; 'check' or 'enqueue'.
1820 * @param CRM_Queue_Queue $queue
1821 * (for 'enqueue') the modifiable list of pending up upgrade tasks.
1822 *
1823 * @return bool|null
1824 * NULL, if $op is 'enqueue'.
1825 * TRUE, if $op is 'check' and upgrades are pending.
1826 * FALSE, if $op is 'check' and upgrades are not pending.
1827 */
1828 public static function upgrade($op, CRM_Queue_Queue $queue = NULL) {
1829 return self::singleton()->invoke(['op', 'queue'], $op, $queue,
1830 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1831 self::$_nullObject,
1832 'civicrm_upgrade'
1833 );
1834 }
1835
1836 /**
1837 * This hook is called when an email has been successfully sent by CiviCRM, but not on an error.
1838 *
1839 * @param array $params
1840 * The mailing parameters. Array fields include: groupName, from, toName,
1841 * toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers,
1842 * attachments (array)
1843 *
1844 * @return mixed
1845 */
1846 public static function postEmailSend(&$params) {
1847 return self::singleton()->invoke(['params'], $params,
1848 self::$_nullObject, self::$_nullObject,
1849 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1850 'civicrm_postEmailSend'
1851 );
1852 }
1853
1854 /**
1855 * This hook is called when a CiviMail mailing has completed
1856 *
1857 * @param int $mailingId
1858 * Mailing ID
1859 *
1860 * @return mixed
1861 */
1862 public static function postMailing($mailingId) {
1863 return self::singleton()->invoke(['mailingId'], $mailingId,
1864 self::$_nullObject, self::$_nullObject,
1865 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1866 'civicrm_postMailing'
1867 );
1868 }
1869
1870 /**
1871 * This hook is called when Settings specifications are loaded.
1872 *
1873 * @param array $settingsFolders
1874 * List of paths from which to derive metadata
1875 *
1876 * @return mixed
1877 */
1878 public static function alterSettingsFolders(&$settingsFolders) {
1879 return self::singleton()->invoke(['settingsFolders'], $settingsFolders,
1880 self::$_nullObject, self::$_nullObject,
1881 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1882 'civicrm_alterSettingsFolders'
1883 );
1884 }
1885
1886 /**
1887 * This hook is called when Settings have been loaded from the xml
1888 * It is an opportunity for hooks to alter the data
1889 *
1890 * @param array $settingsMetaData
1891 * Settings Metadata.
1892 * @param int $domainID
1893 * @param mixed $profile
1894 *
1895 * @return mixed
1896 */
1897 public static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) {
1898 return self::singleton()->invoke(['settingsMetaData', 'domainID', 'profile'], $settingsMetaData,
1899 $domainID, $profile,
1900 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1901 'civicrm_alterSettingsMetaData'
1902 );
1903 }
1904
1905 /**
1906 * This hook is called before running an api call.
1907 *
1908 * @param API_Wrapper[] $wrappers
1909 * (see CRM_Utils_API_ReloadOption as an example)
1910 * @param mixed $apiRequest
1911 *
1912 * @return null
1913 * The return value is ignored
1914 */
1915 public static function apiWrappers(&$wrappers, $apiRequest) {
1916 return self::singleton()
1917 ->invoke(['wrappers', 'apiRequest'], $wrappers, $apiRequest, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1918 self::$_nullObject, 'civicrm_apiWrappers'
1919 );
1920 }
1921
1922 /**
1923 * This hook is called before running pending cron jobs.
1924 *
1925 * @param CRM_Core_JobManager $jobManager
1926 *
1927 * @return null
1928 * The return value is ignored.
1929 */
1930 public static function cron($jobManager) {
1931 return self::singleton()->invoke(['jobManager'],
1932 $jobManager, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1933 'civicrm_cron'
1934 );
1935 }
1936
1937 /**
1938 * This hook is called when loading CMS permissions; use this hook to modify
1939 * the array of system permissions for CiviCRM.
1940 *
1941 * @param array $permissions
1942 * Array of permissions. See CRM_Core_Permission::getCorePermissions() for
1943 * the format of this array.
1944 *
1945 * @return null
1946 * The return value is ignored
1947 */
1948 public static function permission(&$permissions) {
1949 return self::singleton()->invoke(['permissions'], $permissions,
1950 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
1951 'civicrm_permission'
1952 );
1953 }
1954
1955 /**
1956 * This hook is called when checking permissions; use this hook to dynamically
1957 * escalate user permissions in certain use cases (cf. CRM-19256).
1958 *
1959 * @param string $permission
1960 * The name of an atomic permission, ie. 'access deleted contacts'
1961 * @param bool $granted
1962 * Whether this permission is currently granted. The hook can change this value.
1963 * @param int $contactId
1964 * Contact whose permissions we are checking (if null, assume current user).
1965 *
1966 * @return null
1967 * The return value is ignored
1968 */
1969 public static function permission_check($permission, &$granted, $contactId) {
1970 return self::singleton()->invoke(['permission', 'granted', 'contactId'], $permission, $granted, $contactId,
1971 self::$_nullObject, self::$_nullObject, self::$_nullObject,
1972 'civicrm_permission_check'
1973 );
1974 }
1975
1976 /**
1977 * @param CRM_Core_Exception $exception
1978 * @param mixed $request
1979 * Reserved for future use.
1980 */
1981 public static function unhandledException($exception, $request = NULL) {
1982 $event = new \Civi\Core\Event\UnhandledExceptionEvent($exception, self::$_nullObject);
1983 \Civi::dispatcher()->dispatch('hook_civicrm_unhandled_exception', $event);
1984 }
1985
1986 /**
1987 * This hook is called for declaring managed entities via API.
1988 *
1989 * Note: This is a pre-boot hook. It will dispatch via the extension/module
1990 * subsystem but *not* the Symfony EventDispatcher.
1991 *
1992 * @param array[] $entityTypes
1993 * List of entity types; each entity-type is an array with keys:
1994 * - name: string, a unique short name (e.g. "ReportInstance")
1995 * - class: string, a PHP DAO class (e.g. "CRM_Report_DAO_Instance")
1996 * - table: string, a SQL table name (e.g. "civicrm_report_instance")
1997 * - fields_callback: array, list of callables which manipulates field list
1998 * - links_callback: array, list of callables which manipulates fk list
1999 *
2000 * @return null
2001 * The return value is ignored
2002 */
2003 public static function entityTypes(&$entityTypes) {
2004 return self::singleton()->invoke(['entityTypes'], $entityTypes, self::$_nullObject, self::$_nullObject,
2005 self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_entityTypes'
2006 );
2007 }
2008
2009 /**
2010 * Build a description of available hooks.
2011 *
2012 * @param \Civi\Core\CiviEventInspector $inspector
2013 */
2014 public static function eventDefs($inspector) {
2015 $event = \Civi\Core\Event\GenericHookEvent::create([
2016 'inspector' => $inspector,
2017 ]);
2018 Civi::dispatcher()->dispatch('hook_civicrm_eventDefs', $event);
2019 }
2020
2021 /**
2022 * This hook is called while preparing a profile form.
2023 *
2024 * @param string $profileName
2025 * @return mixed
2026 */
2027 public static function buildProfile($profileName) {
2028 return self::singleton()->invoke(['profileName'], $profileName, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2029 self::$_nullObject, self::$_nullObject, 'civicrm_buildProfile');
2030 }
2031
2032 /**
2033 * This hook is called while validating a profile form submission.
2034 *
2035 * @param string $profileName
2036 * @return mixed
2037 */
2038 public static function validateProfile($profileName) {
2039 return self::singleton()->invoke(['profileName'], $profileName, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2040 self::$_nullObject, self::$_nullObject, 'civicrm_validateProfile');
2041 }
2042
2043 /**
2044 * This hook is called processing a valid profile form submission.
2045 *
2046 * @param string $profileName
2047 * @return mixed
2048 */
2049 public static function processProfile($profileName) {
2050 return self::singleton()->invoke(['profileName'], $profileName, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2051 self::$_nullObject, self::$_nullObject, 'civicrm_processProfile');
2052 }
2053
2054 /**
2055 * This hook is called while preparing a read-only profile screen
2056 *
2057 * @param string $profileName
2058 * @return mixed
2059 */
2060 public static function viewProfile($profileName) {
2061 return self::singleton()->invoke(['profileName'], $profileName, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2062 self::$_nullObject, self::$_nullObject, 'civicrm_viewProfile');
2063 }
2064
2065 /**
2066 * This hook is called while preparing a list of contacts (based on a profile)
2067 *
2068 * @param string $profileName
2069 * @return mixed
2070 */
2071 public static function searchProfile($profileName) {
2072 return self::singleton()->invoke(['profileName'], $profileName, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2073 self::$_nullObject, self::$_nullObject, 'civicrm_searchProfile');
2074 }
2075
2076 /**
2077 * This hook is invoked when building a CiviCRM name badge.
2078 *
2079 * @param string $labelName
2080 * String referencing name of badge format.
2081 * @param object $label
2082 * Reference to the label object.
2083 * @param array $format
2084 * Array of format data.
2085 * @param array $participant
2086 * Array of participant values.
2087 *
2088 * @return null
2089 * the return value is ignored
2090 */
2091 public static function alterBadge($labelName, &$label, &$format, &$participant) {
2092 return self::singleton()
2093 ->invoke(['labelName', 'label', 'format', 'participant'], $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
2094 }
2095
2096 /**
2097 * This hook is called before encoding data in barcode.
2098 *
2099 * @param array $data
2100 * Associated array of values available for encoding.
2101 * @param string $type
2102 * Type of barcode, classic barcode or QRcode.
2103 * @param string $context
2104 * Where this hooks is invoked.
2105 *
2106 * @return mixed
2107 */
2108 public static function alterBarcode(&$data, $type = 'barcode', $context = 'name_badge') {
2109 return self::singleton()->invoke(['data', 'type', 'context'], $data, $type, $context, self::$_nullObject,
2110 self::$_nullObject, self::$_nullObject, 'civicrm_alterBarcode');
2111 }
2112
2113 /**
2114 * Modify or replace the Mailer object used for outgoing mail.
2115 *
2116 * @param object $mailer
2117 * The default mailer produced by normal configuration; a PEAR "Mail" class (like those returned by Mail::factory)
2118 * @param string $driver
2119 * The type of the default mailer (eg "smtp", "sendmail", "mock", "CRM_Mailing_BAO_Spool")
2120 * @param array $params
2121 * The default mailer config options
2122 *
2123 * @return mixed
2124 * @see Mail::factory
2125 */
2126 public static function alterMailer(&$mailer, $driver, $params) {
2127 return self::singleton()
2128 ->invoke(['mailer', 'driver', 'params'], $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer');
2129 }
2130
2131 /**
2132 * This hook is called while building the core search query,
2133 * so hook implementers can provide their own query objects which alters/extends core search.
2134 *
2135 * @param array $queryObjects
2136 * @param string $type
2137 *
2138 * @return mixed
2139 */
2140 public static function queryObjects(&$queryObjects, $type = 'Contact') {
2141 return self::singleton()
2142 ->invoke(['queryObjects', 'type'], $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
2143 }
2144
2145 /**
2146 * This hook is called while viewing contact dashboard.
2147 *
2148 * @param array $availableDashlets
2149 * List of dashlets; each is formatted per api/v3/Dashboard
2150 * @param array $defaultDashlets
2151 * List of dashlets; each is formatted per api/v3/DashboardContact
2152 *
2153 * @return mixed
2154 */
2155 public static function dashboard_defaults($availableDashlets, &$defaultDashlets) {
2156 return self::singleton()
2157 ->invoke(['availableDashlets', 'defaultDashlets'], $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
2158 }
2159
2160 /**
2161 * This hook is called before a case merge (or a case reassign)
2162 *
2163 * @param int $mainContactId
2164 * @param int $mainCaseId
2165 * @param int $otherContactId
2166 * @param int $otherCaseId
2167 * @param bool $changeClient
2168 *
2169 * @return mixed
2170 */
2171 public static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
2172 return self::singleton()
2173 ->invoke(['mainContactId', 'mainCaseId', 'otherContactId', 'otherCaseId', 'changeClient'], $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge');
2174 }
2175
2176 /**
2177 * This hook is called after a case merge (or a case reassign)
2178 *
2179 * @param int $mainContactId
2180 * @param int $mainCaseId
2181 * @param int $otherContactId
2182 * @param int $otherCaseId
2183 * @param bool $changeClient
2184 *
2185 * @return mixed
2186 */
2187 public static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
2188 return self::singleton()
2189 ->invoke(['mainContactId', 'mainCaseId', 'otherContactId', 'otherCaseId', 'changeClient'], $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge');
2190 }
2191
2192 /**
2193 * Issue CRM-14276
2194 * Add a hook for altering the display name
2195 *
2196 * hook_civicrm_contact_get_displayname(&$display_name, $objContact)
2197 *
2198 * @param string $displayName
2199 * @param int $contactId
2200 * @param object $dao
2201 * The contact object.
2202 *
2203 * @return mixed
2204 */
2205 public static function alterDisplayName(&$displayName, $contactId, $dao) {
2206 return self::singleton()->invoke(['displayName', 'contactId', 'dao'],
2207 $displayName, $contactId, $dao, self::$_nullObject, self::$_nullObject,
2208 self::$_nullObject, 'civicrm_contact_get_displayname'
2209 );
2210 }
2211
2212 /**
2213 * Modify the CRM_Core_Resources settings data.
2214 *
2215 * @param array $data
2216 * @see CRM_Core_Resources::addSetting
2217 */
2218 public static function alterResourceSettings(&$data) {
2219 $event = \Civi\Core\Event\GenericHookEvent::create([
2220 'data' => &$data,
2221 ]);
2222 Civi::dispatcher()->dispatch('hook_civicrm_alterResourceSettings', $event);
2223 }
2224
2225 /**
2226 * EXPERIMENTAL: This hook allows one to register additional Angular modules
2227 *
2228 * @param array $angularModules
2229 * List of modules. Each module defines:
2230 * - ext: string, the CiviCRM extension which hosts the files.
2231 * - js: array, list of JS files or globs.
2232 * - css: array, list of CSS files or globs.
2233 * - partials: array, list of base-dirs containing HTML.
2234 * - partialsCallback: mixed, a callback function which generates a list of HTML
2235 * function(string $moduleName, array $moduleDefn) => array(string $file => string $html)
2236 * For future-proofing, use a serializable callback (e.g. string/array).
2237 * See also: Civi\Core\Resolver.
2238 * - requires: array, list of required Angular modules.
2239 * - basePages: array, uncondtionally load this module onto the given Angular pages. [v4.7.21+]
2240 * If omitted, default to "array('civicrm/a')" for backward compat.
2241 * For a utility that should only be loaded on-demand, use "array()".
2242 * For a utility that should be loaded in all pages use, "array('*')".
2243 *
2244 * ```
2245 * function mymod_civicrm_angularModules(&$angularModules) {
2246 * $angularModules['myAngularModule'] = array(
2247 * 'ext' => 'org.example.mymod',
2248 * 'js' => array('js/myAngularModule.js'),
2249 * );
2250 * $angularModules['myBigAngularModule'] = array(
2251 * 'ext' => 'org.example.mymod',
2252 * 'js' => array('js/part1.js', 'js/part2.js', 'ext://other.ext.name/file.js', 'assetBuilder://dynamicAsset.js'),
2253 * 'css' => array('css/myAngularModule.css', 'ext://other.ext.name/file.css', 'assetBuilder://dynamicAsset.css'),
2254 * 'partials' => array('partials/myBigAngularModule'),
2255 * 'requires' => array('otherModuleA', 'otherModuleB'),
2256 * 'basePages' => array('civicrm/a'),
2257 * );
2258 * }
2259 * ```
2260 *
2261 * @return null
2262 * the return value is ignored
2263 */
2264 public static function angularModules(&$angularModules) {
2265 return self::singleton()->invoke(['angularModules'], $angularModules,
2266 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2267 'civicrm_angularModules'
2268 );
2269 }
2270
2271 /**
2272 * Alter the definition of some Angular HTML partials.
2273 *
2274 * @param \Civi\Angular\Manager $angular
2275 *
2276 * ```
2277 * function example_civicrm_alterAngular($angular) {
2278 * $changeSet = \Civi\Angular\ChangeSet::create('mychanges')
2279 * ->alterHtml('~/crmMailing/EditMailingCtrl/2step.html', function(phpQueryObject $doc) {
2280 * $doc->find('[ng-form="crmMailingSubform"]')->attr('cat-stevens', 'ts(\'wild world\')');
2281 * })
2282 * );
2283 * $angular->add($changeSet);
2284 * }
2285 * ```
2286 */
2287 public static function alterAngular($angular) {
2288 $event = \Civi\Core\Event\GenericHookEvent::create([
2289 'angular' => $angular,
2290 ]);
2291 Civi::dispatcher()->dispatch('hook_civicrm_alterAngular', $event);
2292 }
2293
2294 /**
2295 * This hook is called when building a link to a semi-static asset.
2296 *
2297 * @param string $asset
2298 * The name of the asset.
2299 * Ex: 'angular.json'
2300 * @param array $params
2301 * List of optional arguments which influence the content.
2302 * @return null
2303 * the return value is ignored
2304 */
2305 public static function getAssetUrl(&$asset, &$params) {
2306 return self::singleton()->invoke(['asset', 'params'],
2307 $asset, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2308 'civicrm_getAssetUrl'
2309 );
2310 }
2311
2312 /**
2313 * This hook is called whenever the system builds a new copy of
2314 * semi-static asset.
2315 *
2316 * @param string $asset
2317 * The name of the asset.
2318 * Ex: 'angular.json'
2319 * @param array $params
2320 * List of optional arguments which influence the content.
2321 * Note: Params are immutable because they are part of the cache-key.
2322 * @param string $mimeType
2323 * Initially, NULL. Modify to specify the mime-type.
2324 * @param string $content
2325 * Initially, NULL. Modify to specify the rendered content.
2326 * @return null
2327 * the return value is ignored
2328 */
2329 public static function buildAsset($asset, $params, &$mimeType, &$content) {
2330 return self::singleton()->invoke(['asset', 'params', 'mimeType', 'content'],
2331 $asset, $params, $mimeType, $content, self::$_nullObject, self::$_nullObject,
2332 'civicrm_buildAsset'
2333 );
2334 }
2335
2336 /**
2337 * This hook fires whenever a record in a case changes.
2338 *
2339 * @param \Civi\CCase\Analyzer $analyzer
2340 * A bundle of data about the case (such as the case and activity records).
2341 */
2342 public static function caseChange(\Civi\CCase\Analyzer $analyzer) {
2343 $event = new \Civi\CCase\Event\CaseChangeEvent($analyzer);
2344 \Civi::dispatcher()->dispatch('hook_civicrm_caseChange', $event);
2345 }
2346
2347 /**
2348 * Generate a default CRUD URL for an entity.
2349 *
2350 * @param array $spec
2351 * With keys:.
2352 * - action: int, eg CRM_Core_Action::VIEW or CRM_Core_Action::UPDATE
2353 * - entity_table: string
2354 * - entity_id: int
2355 * @param CRM_Core_DAO $bao
2356 * @param array $link
2357 * To define the link, add these keys to $link:.
2358 * - title: string
2359 * - path: string
2360 * - query: array
2361 * - url: string (used in lieu of "path"/"query")
2362 * Note: if making "url" CRM_Utils_System::url(), set $htmlize=false
2363 * @return mixed
2364 */
2365 public static function crudLink($spec, $bao, &$link) {
2366 return self::singleton()->invoke(['spec', 'bao', 'link'], $spec, $bao, $link,
2367 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2368 'civicrm_crudLink'
2369 );
2370 }
2371
2372 /**
2373 * Modify the CiviCRM container - add new services, parameters, extensions, etc.
2374 *
2375 * ```
2376 * use Symfony\Component\Config\Resource\FileResource;
2377 * use Symfony\Component\DependencyInjection\Definition;
2378 *
2379 * function mymodule_civicrm_container($container) {
2380 * $container->addResource(new FileResource(__FILE__));
2381 * $container->setDefinition('mysvc', new Definition('My\Class', array()));
2382 * }
2383 * ```
2384 *
2385 * Tip: The container configuration will be compiled/cached. The default cache
2386 * behavior is aggressive. When you first implement the hook, be sure to
2387 * flush the cache. Additionally, you should relax caching during development.
2388 * In `civicrm.settings.php`, set define('CIVICRM_CONTAINER_CACHE', 'auto').
2389 *
2390 * Note: This is a preboot hook. It will dispatch via the extension/module
2391 * subsystem but *not* the Symfony EventDispatcher.
2392 *
2393 * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
2394 * @see http://symfony.com/doc/current/components/dependency_injection/index.html
2395 */
2396 public static function container(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
2397 self::singleton()->invoke(['container'], $container, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_container');
2398 }
2399
2400 /**
2401 * @param array $fileSearches CRM_Core_FileSearchInterface
2402 * @return mixed
2403 */
2404 public static function fileSearches(&$fileSearches) {
2405 return self::singleton()->invoke(['fileSearches'], $fileSearches,
2406 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2407 'civicrm_fileSearches'
2408 );
2409 }
2410
2411 /**
2412 * Check system status.
2413 *
2414 * @param array $messages
2415 * Array<CRM_Utils_Check_Message>. A list of messages regarding system status.
2416 * @return mixed
2417 */
2418 public static function check(&$messages) {
2419 return self::singleton()
2420 ->invoke(['messages'], $messages, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_check');
2421 }
2422
2423 /**
2424 * This hook is called when a query string of the CSV Batch export is generated.
2425 *
2426 * @param string $query
2427 *
2428 * @return mixed
2429 */
2430 public static function batchQuery(&$query) {
2431 return self::singleton()->invoke(['query'], $query, self::$_nullObject,
2432 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2433 'civicrm_batchQuery'
2434 );
2435 }
2436
2437 /**
2438 * This hook is called to alter Deferred revenue item values just before they are
2439 * inserted in civicrm_financial_trxn table
2440 *
2441 * @param array $deferredRevenues
2442 *
2443 * @param array $contributionDetails
2444 *
2445 * @param bool $update
2446 *
2447 * @param string $context
2448 *
2449 * @return mixed
2450 */
2451 public static function alterDeferredRevenueItems(&$deferredRevenues, $contributionDetails, $update, $context) {
2452 return self::singleton()->invoke(['deferredRevenues', 'contributionDetails', 'update', 'context'], $deferredRevenues, $contributionDetails, $update, $context,
2453 self::$_nullObject, self::$_nullObject, 'civicrm_alterDeferredRevenueItems'
2454 );
2455 }
2456
2457 /**
2458 * This hook is called when the entries of the CSV Batch export are mapped.
2459 *
2460 * @param array $results
2461 * @param array $items
2462 *
2463 * @return mixed
2464 */
2465 public static function batchItems(&$results, &$items) {
2466 return self::singleton()->invoke(['results', 'items'], $results, $items,
2467 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2468 'civicrm_batchItems'
2469 );
2470 }
2471
2472 /**
2473 * This hook is called when core resources are being loaded
2474 *
2475 * @see CRM_Core_Resources::coreResourceList
2476 *
2477 * @param array $list
2478 * @param string $region
2479 */
2480 public static function coreResourceList(&$list, $region) {
2481 self::singleton()->invoke(['list', 'region'], $list, $region,
2482 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2483 'civicrm_coreResourceList'
2484 );
2485 }
2486
2487 /**
2488 * Allows the list of filters on the EntityRef widget to be altered.
2489 *
2490 * @see CRM_Core_Resources::entityRefFilters
2491 *
2492 * @param array $filters
2493 * @param array $links
2494 */
2495 public static function entityRefFilters(&$filters, &$links = NULL) {
2496 self::singleton()->invoke(['filters', 'links'], $filters, $links, self::$_nullObject,
2497 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2498 'civicrm_entityRefFilters'
2499 );
2500 }
2501
2502 /**
2503 * This hook is called for bypass a few civicrm urls from IDS check.
2504 *
2505 * @param array $skip list of civicrm urls
2506 *
2507 * @return mixed
2508 */
2509 public static function idsException(&$skip) {
2510 return self::singleton()->invoke(['skip'], $skip, self::$_nullObject,
2511 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2512 'civicrm_idsException'
2513 );
2514 }
2515
2516 /**
2517 * This hook is called when a geocoder's format method is called.
2518 *
2519 * @param string $geoProvider
2520 * @param array $values
2521 * @param SimpleXMLElement $xml
2522 *
2523 * @return mixed
2524 */
2525 public static function geocoderFormat($geoProvider, &$values, $xml) {
2526 return self::singleton()->invoke(['geoProvider', 'values', 'xml'], $geoProvider, $values, $xml,
2527 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2528 'civicrm_geocoderFormat'
2529 );
2530 }
2531
2532 /**
2533 * This hook is called before an inbound SMS is processed.
2534 *
2535 * @param \CRM_SMS_Message $message
2536 * An SMS message received
2537 * @return mixed
2538 */
2539 public static function inboundSMS(&$message) {
2540 return self::singleton()->invoke(['message'], $message, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_inboundSMS');
2541 }
2542
2543 /**
2544 * This hook is called to modify api params of EntityRef form field
2545 *
2546 * @param array $params
2547 * @param string $formName
2548 * @return mixed
2549 */
2550 public static function alterEntityRefParams(&$params, $formName) {
2551 return self::singleton()->invoke(['params', 'formName'], $params, $formName,
2552 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2553 'civicrm_alterEntityRefParams'
2554 );
2555 }
2556
2557 /**
2558 * This hook is called before a scheduled job is executed
2559 *
2560 * @param CRM_Core_DAO_Job $job
2561 * The job to be executed
2562 * @param array $params
2563 * The arguments to be given to the job
2564 */
2565 public static function preJob($job, $params) {
2566 return self::singleton()->invoke(['job', 'params'], $job, $params,
2567 self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
2568 'civicrm_preJob'
2569 );
2570 }
2571
2572 /**
2573 * This hook is called after a scheduled job is executed
2574 *
2575 * @param CRM_Core_DAO_Job $job
2576 * The job that was executed
2577 * @param array $params
2578 * The arguments given to the job
2579 * @param array $result
2580 * The result of the API call, or the thrown exception if any
2581 */
2582 public static function postJob($job, $params, $result) {
2583 return self::singleton()->invoke(['job', 'params', 'result'], $job, $params, $result,
2584 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2585 'civicrm_postJob'
2586 );
2587 }
2588
2589 /**
2590 * This hook is called before and after constructing mail recipients.
2591 * Allows user to alter filter and/or search query to fetch mail recipients
2592 *
2593 * @param CRM_Mailing_DAO_Mailing $mailingObject
2594 * @param array $criteria
2595 * A list of SQL criteria; you can add/remove/replace/modify criteria.
2596 * Array(string $name => CRM_Utils_SQL_Select $criterion).
2597 * Ex: array('do_not_email' => CRM_Utils_SQL_Select::fragment()->where("$contact.do_not_email = 0")).
2598 * @param string $context
2599 * Ex: 'pre', 'post'
2600 * @return mixed
2601 */
2602 public static function alterMailingRecipients(&$mailingObject, &$criteria, $context) {
2603 return self::singleton()->invoke(['mailingObject', 'params', 'context'],
2604 $mailingObject, $criteria, $context,
2605 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2606 'civicrm_alterMailingRecipients'
2607 );
2608 }
2609
2610 /**
2611 * ALlow Extensions to custom process IPN hook data such as sending Google Analyitcs information based on the IPN
2612 * @param array $IPNData - Array of IPN Data
2613 * @return mixed
2614 */
2615 public static function postIPNProcess(&$IPNData) {
2616 return self::singleton()->invoke(['IPNData'],
2617 $IPNData, self::$_nullObject, self::$_nullObject,
2618 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2619 'civicrm_postIPNProcess'
2620 );
2621 }
2622
2623 /**
2624 * Allow extensions to modify the array of acceptable fields to be included on profiles
2625 * @param array $fields
2626 * format is [Entity => array of DAO fields]
2627 * @return mixed
2628 */
2629 public static function alterUFFields(&$fields) {
2630 return self::singleton()->invoke(['fields'],
2631 $fields, self::$_nullObject, self::$_nullObject,
2632 self::$_nullObject, self::$_nullObject, self::$_nullObject,
2633 'civicrm_alterUFFields'
2634 );
2635 }
2636
2637 /**
2638 * This hook is called to alter Custom field value before its displayed.
2639 *
2640 * @param string $displayValue
2641 * @param mixed $value
2642 * @param int $entityId
2643 * @param array $fieldInfo
2644 *
2645 * @return mixed
2646 */
2647 public static function alterCustomFieldDisplayValue(&$displayValue, $value, $entityId, $fieldInfo) {
2648 return self::singleton()->invoke(
2649 ['displayValue', 'value', 'entityId', 'fieldInfo'],
2650 $displayValue, $value, $entityId, $fieldInfo, self::$_nullObject,
2651 self::$_nullObject, 'civicrm_alterCustomFieldDisplayValue'
2652 );
2653 }
2654
2655 }