Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
7e9e8871 | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CiviCRM_Hook | |
e7112fa7 | 31 | * @copyright CiviCRM LLC (c) 2004-2015 |
6a488035 | 32 | */ |
6a488035 TO |
33 | abstract class CRM_Utils_Hook { |
34 | ||
35 | // Allowed values for dashboard hook content placement | |
36 | // Default - place content below activity list | |
7da04cde | 37 | const DASHBOARD_BELOW = 1; |
6a488035 | 38 | // Place content above activity list |
7da04cde | 39 | const DASHBOARD_ABOVE = 2; |
6a488035 | 40 | // Don't display activity list at all |
7da04cde | 41 | const DASHBOARD_REPLACE = 3; |
6a488035 TO |
42 | |
43 | // by default - place content below existing content | |
7da04cde | 44 | const SUMMARY_BELOW = 1; |
6a488035 | 45 | // pace hook content above |
7da04cde | 46 | const SUMMARY_ABOVE = 2; |
6a488035 | 47 | // create your own summarys |
7da04cde | 48 | const SUMMARY_REPLACE = 3; |
6a488035 TO |
49 | |
50 | static $_nullObject = NULL; | |
51 | ||
52 | /** | |
53 | * We only need one instance of this object. So we use the singleton | |
54 | * pattern and cache the instance in this variable | |
55 | * | |
56 | * @var object | |
6a488035 TO |
57 | */ |
58 | static private $_singleton = NULL; | |
59 | ||
60 | /** | |
61 | * @var bool | |
62 | */ | |
63 | private $commonIncluded = FALSE; | |
64 | ||
65 | /** | |
66 | * @var array(string) | |
67 | */ | |
68 | private $commonCiviModules = array(); | |
69 | ||
70 | /** | |
fe482240 | 71 | * Constructor and getter for the singleton instance. |
6a488035 | 72 | * |
72536736 AH |
73 | * @param bool $fresh |
74 | * | |
75 | * @return self | |
76 | * An instance of $config->userHookClass | |
6a488035 | 77 | */ |
00be9182 | 78 | public static function singleton($fresh = FALSE) { |
6a488035 TO |
79 | if (self::$_singleton == NULL || $fresh) { |
80 | $config = CRM_Core_Config::singleton(); | |
81 | $class = $config->userHookClass; | |
6a488035 TO |
82 | self::$_singleton = new $class(); |
83 | } | |
84 | return self::$_singleton; | |
85 | } | |
86 | ||
72536736 | 87 | /** |
fe482240 | 88 | * Invoke hooks. |
f0a7a0c9 | 89 | * |
77855840 TO |
90 | * @param int $numParams |
91 | * Number of parameters to pass to the hook. | |
92 | * @param mixed $arg1 | |
93 | * Parameter to be passed to the hook. | |
94 | * @param mixed $arg2 | |
95 | * Parameter to be passed to the hook. | |
96 | * @param mixed $arg3 | |
97 | * Parameter to be passed to the hook. | |
98 | * @param mixed $arg4 | |
99 | * Parameter to be passed to the hook. | |
100 | * @param mixed $arg5 | |
101 | * Parameter to be passed to the hook. | |
102 | * @param mixed $arg6 | |
103 | * Parameter to be passed to the hook. | |
104 | * @param string $fnSuffix | |
105 | * Function suffix, this is effectively the hook name. | |
72536736 AH |
106 | * |
107 | * @return mixed | |
108 | */ | |
37cd2432 | 109 | public abstract function invoke( |
a3e55d9c | 110 | $numParams, |
87dab4a4 | 111 | &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, |
6a488035 TO |
112 | $fnSuffix |
113 | ); | |
114 | ||
5bc392e6 | 115 | /** |
100fef9d | 116 | * @param array $numParams |
5bc392e6 EM |
117 | * @param $arg1 |
118 | * @param $arg2 | |
119 | * @param $arg3 | |
120 | * @param $arg4 | |
121 | * @param $arg5 | |
122 | * @param $arg6 | |
123 | * @param $fnSuffix | |
124 | * @param $fnPrefix | |
125 | * | |
126 | * @return array|bool | |
127 | */ | |
37cd2432 | 128 | public function commonInvoke( |
a3e55d9c | 129 | $numParams, |
87dab4a4 | 130 | &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6, |
6a488035 TO |
131 | $fnSuffix, $fnPrefix |
132 | ) { | |
133 | ||
134 | $this->commonBuildModuleList($fnPrefix); | |
4636d4fd | 135 | |
6a488035 | 136 | return $this->runHooks($this->commonCiviModules, $fnSuffix, |
87dab4a4 | 137 | $numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6 |
6a488035 TO |
138 | ); |
139 | } | |
140 | ||
141 | /** | |
142 | * Build the list of modules to be processed for hooks. | |
72536736 AH |
143 | * |
144 | * @param string $fnPrefix | |
6a488035 | 145 | */ |
00be9182 | 146 | public function commonBuildModuleList($fnPrefix) { |
6a488035 TO |
147 | if (!$this->commonIncluded) { |
148 | // include external file | |
149 | $this->commonIncluded = TRUE; | |
150 | ||
151 | $config = CRM_Core_Config::singleton(); | |
152 | if (!empty($config->customPHPPathDir) && | |
153 | file_exists("{$config->customPHPPathDir}/civicrmHooks.php") | |
154 | ) { | |
e7292422 | 155 | @include_once "civicrmHooks.php"; |
6a488035 TO |
156 | } |
157 | ||
158 | if (!empty($fnPrefix)) { | |
159 | $this->commonCiviModules[$fnPrefix] = $fnPrefix; | |
160 | } | |
161 | ||
162 | $this->requireCiviModules($this->commonCiviModules); | |
163 | } | |
164 | } | |
165 | ||
72536736 AH |
166 | /** |
167 | * @param $civiModules | |
168 | * @param $fnSuffix | |
100fef9d | 169 | * @param array $numParams |
72536736 AH |
170 | * @param $arg1 |
171 | * @param $arg2 | |
172 | * @param $arg3 | |
173 | * @param $arg4 | |
174 | * @param $arg5 | |
175 | * @param $arg6 | |
176 | * | |
177 | * @return array|bool | |
178 | */ | |
37cd2432 | 179 | public function runHooks( |
a3e55d9c | 180 | $civiModules, $fnSuffix, $numParams, |
87dab4a4 | 181 | &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6 |
6a488035 | 182 | ) { |
3ac9ab1c TO |
183 | // $civiModules is *not* passed by reference because runHooks |
184 | // must be reentrant. PHP is finicky about running | |
185 | // multiple loops over the same variable. The circumstances | |
186 | // to reproduce the issue are pretty intricate. | |
1cba072e | 187 | $result = array(); |
6a488035 | 188 | |
4636d4fd DL |
189 | if ($civiModules !== NULL) { |
190 | foreach ($civiModules as $module) { | |
191 | $fnName = "{$module}_{$fnSuffix}"; | |
192 | if (function_exists($fnName)) { | |
1cba072e | 193 | $fResult = array(); |
4636d4fd DL |
194 | switch ($numParams) { |
195 | case 0: | |
196 | $fResult = $fnName(); | |
197 | break; | |
198 | ||
199 | case 1: | |
200 | $fResult = $fnName($arg1); | |
201 | break; | |
202 | ||
203 | case 2: | |
204 | $fResult = $fnName($arg1, $arg2); | |
205 | break; | |
206 | ||
207 | case 3: | |
208 | $fResult = $fnName($arg1, $arg2, $arg3); | |
209 | break; | |
210 | ||
211 | case 4: | |
212 | $fResult = $fnName($arg1, $arg2, $arg3, $arg4); | |
213 | break; | |
214 | ||
215 | case 5: | |
216 | $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5); | |
217 | break; | |
218 | ||
87dab4a4 AH |
219 | case 6: |
220 | $fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6); | |
221 | break; | |
f0a7a0c9 | 222 | |
4636d4fd DL |
223 | default: |
224 | CRM_Core_Error::fatal(ts('Invalid hook invocation')); | |
225 | break; | |
226 | } | |
6a488035 | 227 | |
1cba072e | 228 | if (!empty($fResult) && |
37cd2432 TO |
229 | is_array($fResult) |
230 | ) { | |
1cba072e HH |
231 | $result = array_merge($result, $fResult); |
232 | } | |
4636d4fd | 233 | } |
6a488035 TO |
234 | } |
235 | } | |
236 | ||
237 | return empty($result) ? TRUE : $result; | |
238 | } | |
239 | ||
5bc392e6 EM |
240 | /** |
241 | * @param $moduleList | |
242 | */ | |
00be9182 | 243 | public function requireCiviModules(&$moduleList) { |
6a488035 TO |
244 | $civiModules = CRM_Core_PseudoConstant::getModuleExtensions(); |
245 | foreach ($civiModules as $civiModule) { | |
246 | if (!file_exists($civiModule['filePath'])) { | |
247 | CRM_Core_Session::setStatus( | |
481a74f4 TO |
248 | ts('Error loading module file (%1). Please restore the file or disable the module.', |
249 | array(1 => $civiModule['filePath'])), | |
250 | ts('Warning'), 'error'); | |
6a488035 TO |
251 | continue; |
252 | } | |
253 | include_once $civiModule['filePath']; | |
254 | $moduleList[$civiModule['prefix']] = $civiModule['prefix']; | |
6a488035 | 255 | } |
e7292422 | 256 | } |
6a488035 TO |
257 | |
258 | /** | |
259 | * This hook is called before a db write on some core objects. | |
260 | * This hook does not allow the abort of the operation | |
261 | * | |
77855840 TO |
262 | * @param string $op |
263 | * The type of operation being performed. | |
264 | * @param string $objectName | |
265 | * The name of the object. | |
266 | * @param int $id | |
267 | * The object id if available. | |
268 | * @param array $params | |
269 | * The parameters used for object creation / editing. | |
6a488035 | 270 | * |
a6c01b45 CW |
271 | * @return null |
272 | * the return value is ignored | |
6a488035 | 273 | */ |
00be9182 | 274 | public static function pre($op, $objectName, $id, &$params) { |
fd901044 TO |
275 | $event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params); |
276 | \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre", $event); | |
277 | \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_pre::$objectName", $event); | |
37cd2432 TO |
278 | return self::singleton() |
279 | ->invoke(4, $op, $objectName, $id, $params, self::$_nullObject, self::$_nullObject, 'civicrm_pre'); | |
6a488035 TO |
280 | } |
281 | ||
282 | /** | |
283 | * This hook is called after a db write on some core objects. | |
284 | * | |
77855840 TO |
285 | * @param string $op |
286 | * The type of operation being performed. | |
287 | * @param string $objectName | |
288 | * The name of the object. | |
289 | * @param int $objectId | |
290 | * The unique identifier for the object. | |
291 | * @param object $objectRef | |
292 | * The reference to the object if available. | |
6a488035 | 293 | * |
72b3a70c CW |
294 | * @return mixed |
295 | * based on op. pre-hooks return a boolean or | |
6a488035 | 296 | * an error message which aborts the operation |
6a488035 | 297 | */ |
00be9182 | 298 | public static function post($op, $objectName, $objectId, &$objectRef) { |
fd901044 TO |
299 | $event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef); |
300 | \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post", $event); | |
301 | \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_post::$objectName", $event); | |
37cd2432 TO |
302 | return self::singleton() |
303 | ->invoke(4, $op, $objectName, $objectId, $objectRef, self::$_nullObject, self::$_nullObject, 'civicrm_post'); | |
6a488035 TO |
304 | } |
305 | ||
6a488035 | 306 | /** |
fe482240 | 307 | * This hook retrieves links from other modules and injects it into. |
6a488035 TO |
308 | * the view contact tabs |
309 | * | |
77855840 TO |
310 | * @param string $op |
311 | * The type of operation being performed. | |
312 | * @param string $objectName | |
313 | * The name of the object. | |
314 | * @param int $objectId | |
315 | * The unique identifier for the object. | |
316 | * @param array $links | |
317 | * (optional) the links array (introduced in v3.2). | |
318 | * @param int $mask | |
319 | * (optional) the bitmask to show/hide links. | |
320 | * @param array $values | |
321 | * (optional) the values to fill the links. | |
6a488035 | 322 | * |
a6c01b45 CW |
323 | * @return null |
324 | * the return value is ignored | |
6a488035 | 325 | */ |
00be9182 | 326 | public static function links($op, $objectName, &$objectId, &$links, &$mask = NULL, &$values = array()) { |
87dab4a4 | 327 | return self::singleton()->invoke(6, $op, $objectName, $objectId, $links, $mask, $values, 'civicrm_links'); |
6a488035 TO |
328 | } |
329 | ||
21d2903d AN |
330 | /** |
331 | * This hook is invoked during the CiviCRM form preProcess phase. | |
332 | * | |
77855840 TO |
333 | * @param string $formName |
334 | * The name of the form. | |
335 | * @param CRM_Core_Form $form | |
336 | * Reference to the form object. | |
21d2903d | 337 | * |
a6c01b45 CW |
338 | * @return null |
339 | * the return value is ignored | |
21d2903d | 340 | */ |
00be9182 | 341 | public static function preProcess($formName, &$form) { |
37cd2432 | 342 | return self::singleton() |
353ffa53 | 343 | ->invoke(2, $formName, $form, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_preProcess'); |
21d2903d AN |
344 | } |
345 | ||
6a488035 TO |
346 | /** |
347 | * This hook is invoked when building a CiviCRM form. This hook should also | |
348 | * be used to set the default values of a form element | |
349 | * | |
77855840 TO |
350 | * @param string $formName |
351 | * The name of the form. | |
352 | * @param CRM_Core_Form $form | |
353 | * Reference to the form object. | |
6a488035 | 354 | * |
a6c01b45 CW |
355 | * @return null |
356 | * the return value is ignored | |
6a488035 | 357 | */ |
00be9182 | 358 | public static function buildForm($formName, &$form) { |
37cd2432 TO |
359 | return self::singleton()->invoke(2, $formName, $form, |
360 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
361 | 'civicrm_buildForm' | |
362 | ); | |
6a488035 TO |
363 | } |
364 | ||
365 | /** | |
366 | * This hook is invoked when a CiviCRM form is submitted. If the module has injected | |
367 | * any form elements, this hook should save the values in the database | |
368 | * | |
77855840 TO |
369 | * @param string $formName |
370 | * The name of the form. | |
371 | * @param CRM_Core_Form $form | |
372 | * Reference to the form object. | |
6a488035 | 373 | * |
a6c01b45 CW |
374 | * @return null |
375 | * the return value is ignored | |
6a488035 | 376 | */ |
00be9182 | 377 | public static function postProcess($formName, &$form) { |
37cd2432 TO |
378 | return self::singleton()->invoke(2, $formName, $form, |
379 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
380 | 'civicrm_postProcess' | |
381 | ); | |
6a488035 TO |
382 | } |
383 | ||
384 | /** | |
385 | * This hook is invoked during all CiviCRM form validation. An array of errors | |
6a488035 TO |
386 | * detected is returned. Else we assume validation succeeded. |
387 | * | |
77855840 TO |
388 | * @param string $formName |
389 | * The name of the form. | |
390 | * @param array &$fields the POST parameters as filtered by QF | |
391 | * @param array &$files the FILES parameters as sent in by POST | |
392 | * @param array &$form the form object | |
393 | * @param array &$errors the array of errors. | |
6a488035 | 394 | * |
72b3a70c CW |
395 | * @return mixed |
396 | * formRule hooks return a boolean or | |
6a488035 | 397 | * an array of error messages which display a QF Error |
6a488035 | 398 | */ |
00be9182 | 399 | public static function validateForm($formName, &$fields, &$files, &$form, &$errors) { |
37cd2432 TO |
400 | return self::singleton() |
401 | ->invoke(5, $formName, $fields, $files, $form, $errors, self::$_nullObject, 'civicrm_validateForm'); | |
6a488035 TO |
402 | } |
403 | ||
404 | /** | |
42bc70d4 | 405 | * This hook is called after a db write on a custom table. |
6a488035 | 406 | * |
77855840 TO |
407 | * @param string $op |
408 | * The type of operation being performed. | |
409 | * @param string $groupID | |
410 | * The custom group ID. | |
411 | * @param object $entityID | |
412 | * The entityID of the row in the custom table. | |
413 | * @param array $params | |
414 | * The parameters that were sent into the calling function. | |
6a488035 | 415 | * |
a6c01b45 CW |
416 | * @return null |
417 | * the return value is ignored | |
6a488035 | 418 | */ |
00be9182 | 419 | public static function custom($op, $groupID, $entityID, &$params) { |
37cd2432 TO |
420 | return self::singleton() |
421 | ->invoke(4, $op, $groupID, $entityID, $params, self::$_nullObject, self::$_nullObject, 'civicrm_custom'); | |
6a488035 TO |
422 | } |
423 | ||
424 | /** | |
425 | * This hook is called when composing the ACL where clause to restrict | |
426 | * visibility of contacts to the logged in user | |
427 | * | |
77855840 TO |
428 | * @param int $type |
429 | * The type of permission needed. | |
430 | * @param array $tables | |
431 | * (reference ) add the tables that are needed for the select clause. | |
432 | * @param array $whereTables | |
433 | * (reference ) add the tables that are needed for the where clause. | |
434 | * @param int $contactID | |
435 | * The contactID for whom the check is made. | |
436 | * @param string $where | |
437 | * The currrent where clause. | |
6a488035 | 438 | * |
a6c01b45 CW |
439 | * @return null |
440 | * the return value is ignored | |
6a488035 | 441 | */ |
00be9182 | 442 | public static function aclWhereClause($type, &$tables, &$whereTables, &$contactID, &$where) { |
37cd2432 TO |
443 | return self::singleton() |
444 | ->invoke(5, $type, $tables, $whereTables, $contactID, $where, self::$_nullObject, 'civicrm_aclWhereClause'); | |
6a488035 TO |
445 | } |
446 | ||
447 | /** | |
448 | * This hook is called when composing the ACL where clause to restrict | |
449 | * visibility of contacts to the logged in user | |
450 | * | |
77855840 TO |
451 | * @param int $type |
452 | * The type of permission needed. | |
453 | * @param int $contactID | |
454 | * The contactID for whom the check is made. | |
455 | * @param string $tableName | |
456 | * The tableName which is being permissioned. | |
457 | * @param array $allGroups | |
458 | * The set of all the objects for the above table. | |
459 | * @param array $currentGroups | |
460 | * The set of objects that are currently permissioned for this contact. | |
6a488035 | 461 | * |
a6c01b45 CW |
462 | * @return null |
463 | * the return value is ignored | |
6a488035 | 464 | */ |
00be9182 | 465 | public static function aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) { |
37cd2432 TO |
466 | return self::singleton() |
467 | ->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup'); | |
6a488035 TO |
468 | } |
469 | ||
470 | /** | |
fe482240 | 471 | * This hook is called when building the menu table. |
6a488035 | 472 | * |
77855840 TO |
473 | * @param array $files |
474 | * The current set of files to process. | |
6a488035 | 475 | * |
a6c01b45 CW |
476 | * @return null |
477 | * the return value is ignored | |
6a488035 | 478 | */ |
00be9182 | 479 | public static function xmlMenu(&$files) { |
6a488035 | 480 | return self::singleton()->invoke(1, $files, |
87dab4a4 | 481 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
482 | 'civicrm_xmlMenu' |
483 | ); | |
484 | } | |
485 | ||
486 | /** | |
88718db2 | 487 | * This hook is called for declaring managed entities via API. |
6a488035 | 488 | * |
77855840 | 489 | * @param array $entities |
88718db2 TO |
490 | * List of pending entities. Each entity is an array with keys: |
491 | * + '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") | |
492 | * + 'name': string, a symbolic name which can be used to track this entity (Note: Each module creates its own namespace) | |
493 | * + 'entity': string, an entity-type supported by the CiviCRM API (Note: this currently must be an entity which supports the 'is_active' property) | |
494 | * + 'params': array, the entity data as supported by the CiviCRM API | |
495 | * + 'update' (v4.5+): string, a policy which describes when to update records | |
496 | * - 'always' (default): always update the managed-entity record; changes in $entities will override any local changes (eg by the site-admin) | |
497 | * - 'never': never update the managed-entity record; changes made locally (eg by the site-admin) will override changes in $entities | |
498 | * + '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) | |
499 | * - 'always' (default): always delete orphaned records | |
500 | * - 'never': never delete orphaned records | |
501 | * - '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.) | |
6a488035 | 502 | * |
a6c01b45 CW |
503 | * @return null |
504 | * the return value is ignored | |
6a488035 | 505 | */ |
00be9182 | 506 | public static function managed(&$entities) { |
6a488035 | 507 | return self::singleton()->invoke(1, $entities, |
87dab4a4 | 508 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
509 | 'civicrm_managed' |
510 | ); | |
511 | } | |
512 | ||
513 | /** | |
514 | * This hook is called when rendering the dashboard (q=civicrm/dashboard) | |
515 | * | |
77855840 TO |
516 | * @param int $contactID |
517 | * The contactID for whom the dashboard is being rendered. | |
518 | * @param int $contentPlacement | |
519 | * (output parameter) where should the hook content be displayed. | |
9399901d | 520 | * relative to the activity list |
6a488035 | 521 | * |
a6c01b45 CW |
522 | * @return string |
523 | * the html snippet to include in the dashboard | |
6a488035 | 524 | */ |
00be9182 | 525 | public static function dashboard($contactID, &$contentPlacement = self::DASHBOARD_BELOW) { |
6a488035 | 526 | $retval = self::singleton()->invoke(2, $contactID, $contentPlacement, |
87dab4a4 | 527 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
528 | 'civicrm_dashboard' |
529 | ); | |
530 | ||
531 | /* | |
532 | * Note we need this seemingly unnecessary code because in the event that the implementation | |
533 | * of the hook declares the second parameter but doesn't set it, then it comes back unset even | |
534 | * though we have a default value in this function's declaration above. | |
535 | */ | |
536 | if (!isset($contentPlacement)) { | |
537 | $contentPlacement = self::DASHBOARD_BELOW; | |
538 | } | |
539 | ||
540 | return $retval; | |
541 | } | |
542 | ||
543 | /** | |
544 | * This hook is called before storing recently viewed items. | |
545 | * | |
77855840 TO |
546 | * @param array $recentArray |
547 | * An array of recently viewed or processed items, for in place modification. | |
6a488035 TO |
548 | * |
549 | * @return array | |
6a488035 | 550 | */ |
00be9182 | 551 | public static function recent(&$recentArray) { |
6a488035 | 552 | return self::singleton()->invoke(1, $recentArray, |
87dab4a4 | 553 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
554 | 'civicrm_recent' |
555 | ); | |
556 | } | |
557 | ||
91dee34b | 558 | /** |
fe482240 | 559 | * Determine how many other records refer to a given record. |
91dee34b | 560 | * |
77855840 TO |
561 | * @param CRM_Core_DAO $dao |
562 | * The item for which we want a reference count. | |
563 | * @param array $refCounts | |
16b10e64 | 564 | * Each item in the array is an Array with keys: |
91dee34b TO |
565 | * - name: string, eg "sql:civicrm_email:contact_id" |
566 | * - type: string, eg "sql" | |
567 | * - count: int, eg "5" if there are 5 email addresses that refer to $dao | |
153b262f EM |
568 | * |
569 | * @return mixed | |
570 | * Return is not really intended to be used. | |
91dee34b | 571 | */ |
00be9182 | 572 | public static function referenceCounts($dao, &$refCounts) { |
91dee34b TO |
573 | return self::singleton()->invoke(2, $dao, $refCounts, |
574 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
575 | 'civicrm_referenceCounts' | |
576 | ); | |
577 | } | |
578 | ||
6a488035 | 579 | /** |
fe482240 | 580 | * This hook is called when building the amount structure for a Contribution or Event Page. |
6a488035 | 581 | * |
77855840 TO |
582 | * @param int $pageType |
583 | * Is this a contribution or event page. | |
584 | * @param CRM_Core_Form $form | |
585 | * Reference to the form object. | |
586 | * @param array $amount | |
587 | * The amount structure to be displayed. | |
6a488035 TO |
588 | * |
589 | * @return null | |
6a488035 | 590 | */ |
00be9182 | 591 | public static function buildAmount($pageType, &$form, &$amount) { |
9399901d | 592 | return self::singleton()->invoke(3, $pageType, $form, $amount, self::$_nullObject, |
87dab4a4 | 593 | self::$_nullObject, self::$_nullObject, 'civicrm_buildAmount'); |
6a488035 TO |
594 | } |
595 | ||
596 | /** | |
597 | * This hook is called when building the state list for a particular country. | |
598 | * | |
72536736 AH |
599 | * @param array $countryID |
600 | * The country id whose states are being selected. | |
601 | * @param $states | |
6a488035 TO |
602 | * |
603 | * @return null | |
6a488035 | 604 | */ |
00be9182 | 605 | public static function buildStateProvinceForCountry($countryID, &$states) { |
6a488035 | 606 | return self::singleton()->invoke(2, $countryID, $states, |
87dab4a4 | 607 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
608 | 'civicrm_buildStateProvinceForCountry' |
609 | ); | |
610 | } | |
611 | ||
612 | /** | |
613 | * This hook is called when rendering the tabs for a contact (q=civicrm/contact/view)c | |
614 | * | |
77855840 TO |
615 | * @param array $tabs |
616 | * The array of tabs that will be displayed. | |
617 | * @param int $contactID | |
618 | * The contactID for whom the dashboard is being rendered. | |
6a488035 TO |
619 | * |
620 | * @return null | |
6a488035 | 621 | */ |
00be9182 | 622 | public static function tabs(&$tabs, $contactID) { |
6a488035 | 623 | return self::singleton()->invoke(2, $tabs, $contactID, |
87dab4a4 | 624 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabs' |
6a488035 TO |
625 | ); |
626 | } | |
627 | ||
fa3dbfbd | 628 | /** |
72536736 AH |
629 | * This hook is called when rendering the tabs used for events and potentially |
630 | * contribution pages, etc. | |
631 | * | |
632 | * @param string $tabsetName | |
633 | * Name of the screen or visual element. | |
634 | * @param array $tabs | |
635 | * Tabs that will be displayed. | |
636 | * @param array $context | |
637 | * Extra data about the screen or context in which the tab is used. | |
fa3dbfbd | 638 | * |
2efcf0c2 | 639 | * @return null |
fa3dbfbd | 640 | */ |
00be9182 | 641 | public static function tabset($tabsetName, &$tabs, $context) { |
379a8439 | 642 | return self::singleton()->invoke(3, $tabsetName, $tabs, |
87dab4a4 | 643 | $context, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tabset' |
fa3dbfbd | 644 | ); |
645 | } | |
646 | ||
6a488035 TO |
647 | /** |
648 | * This hook is called when sending an email / printing labels | |
649 | * | |
77855840 TO |
650 | * @param array $tokens |
651 | * The list of tokens that can be used for the contact. | |
6a488035 TO |
652 | * |
653 | * @return null | |
6a488035 | 654 | */ |
00be9182 | 655 | public static function tokens(&$tokens) { |
6a488035 | 656 | return self::singleton()->invoke(1, $tokens, |
87dab4a4 | 657 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_tokens' |
6a488035 TO |
658 | ); |
659 | } | |
660 | ||
661 | /** | |
662 | * This hook is called when sending an email / printing labels to get the values for all the | |
663 | * tokens returned by the 'tokens' hook | |
664 | * | |
77855840 TO |
665 | * @param array $details |
666 | * The array to store the token values indexed by contactIDs (unless it a single). | |
667 | * @param array $contactIDs | |
668 | * An array of contactIDs. | |
669 | * @param int $jobID | |
670 | * The jobID if this is associated with a CiviMail mailing. | |
671 | * @param array $tokens | |
672 | * The list of tokens associated with the content. | |
673 | * @param string $className | |
674 | * The top level className from where the hook is invoked. | |
6a488035 TO |
675 | * |
676 | * @return null | |
6a488035 | 677 | */ |
37cd2432 | 678 | public static function tokenValues( |
a3e55d9c | 679 | &$details, |
6a488035 | 680 | $contactIDs, |
e7292422 TO |
681 | $jobID = NULL, |
682 | $tokens = array(), | |
6a488035 TO |
683 | $className = NULL |
684 | ) { | |
37cd2432 TO |
685 | return self::singleton() |
686 | ->invoke(5, $details, $contactIDs, $jobID, $tokens, $className, self::$_nullObject, 'civicrm_tokenValues'); | |
6a488035 TO |
687 | } |
688 | ||
689 | /** | |
690 | * This hook is called before a CiviCRM Page is rendered. You can use this hook to insert smarty variables | |
691 | * in a template | |
692 | * | |
77855840 TO |
693 | * @param object $page |
694 | * The page that will be rendered. | |
6a488035 TO |
695 | * |
696 | * @return null | |
6a488035 | 697 | */ |
00be9182 | 698 | public static function pageRun(&$page) { |
6a488035 | 699 | return self::singleton()->invoke(1, $page, |
87dab4a4 | 700 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
701 | 'civicrm_pageRun' |
702 | ); | |
703 | } | |
704 | ||
705 | /** | |
706 | * This hook is called after a copy of an object has been made. The current objects are | |
707 | * Event, Contribution Page and UFGroup | |
708 | * | |
77855840 TO |
709 | * @param string $objectName |
710 | * Name of the object. | |
711 | * @param object $object | |
712 | * Reference to the copy. | |
6a488035 TO |
713 | * |
714 | * @return null | |
6a488035 | 715 | */ |
00be9182 | 716 | public static function copy($objectName, &$object) { |
6a488035 | 717 | return self::singleton()->invoke(2, $objectName, $object, |
87dab4a4 | 718 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
719 | 'civicrm_copy' |
720 | ); | |
721 | } | |
722 | ||
723 | /** | |
724 | * This hook is called when a contact unsubscribes from a mailing. It allows modules | |
725 | * to override what the contacts are removed from. | |
726 | * | |
72536736 AH |
727 | * @param string $op |
728 | * Ignored for now | |
729 | * @param int $mailingId | |
730 | * The id of the mailing to unsub from | |
731 | * @param int $contactId | |
732 | * The id of the contact who is unsubscribing | |
733 | * @param array|int $groups | |
734 | * Groups the contact will be removed from. | |
735 | * @param array|int $baseGroups | |
736 | * Base groups (used in smart mailings) the contact will be removed from. | |
737 | * | |
dcbd3a55 | 738 | * |
72536736 AH |
739 | * @return mixed |
740 | */ | |
00be9182 | 741 | public static function unsubscribeGroups($op, $mailingId, $contactId, &$groups, &$baseGroups) { |
37cd2432 TO |
742 | return self::singleton() |
743 | ->invoke(5, $op, $mailingId, $contactId, $groups, $baseGroups, self::$_nullObject, 'civicrm_unsubscribeGroups'); | |
6a488035 TO |
744 | } |
745 | ||
746 | /** | |
9399901d KJ |
747 | * This hook is called when CiviCRM needs to edit/display a custom field with options (select, radio, checkbox, |
748 | * adv multiselect) | |
6a488035 | 749 | * |
77855840 TO |
750 | * @param int $customFieldID |
751 | * The custom field ID. | |
752 | * @param array $options | |
753 | * The current set of options for that custom field. | |
6a488035 | 754 | * You can add/remove existing options. |
9399901d KJ |
755 | * Important: This array may contain meta-data about the field that is needed elsewhere, so it is important |
756 | * to be careful to not overwrite the array. | |
6a488035 | 757 | * Only add/edit/remove the specific field options you intend to affect. |
77855840 TO |
758 | * @param bool $detailedFormat |
759 | * If true,. | |
9399901d | 760 | * the options are in an ID => array ( 'id' => ID, 'label' => label, 'value' => value ) format |
77855840 TO |
761 | * @param array $selectAttributes |
762 | * Contain select attribute(s) if any. | |
72536736 AH |
763 | * |
764 | * @return mixed | |
6a488035 | 765 | */ |
00be9182 | 766 | public static function customFieldOptions($customFieldID, &$options, $detailedFormat = FALSE, $selectAttributes = array()) { |
6a488035 | 767 | return self::singleton()->invoke(3, $customFieldID, $options, $detailedFormat, |
87dab4a4 | 768 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
769 | 'civicrm_customFieldOptions' |
770 | ); | |
771 | } | |
772 | ||
773 | /** | |
774 | * | |
775 | * This hook is called to display the list of actions allowed after doing a search. | |
776 | * This allows the module developer to inject additional actions or to remove existing actions. | |
777 | * | |
77855840 TO |
778 | * @param string $objectType |
779 | * The object type for this search. | |
6a488035 | 780 | * - activity, campaign, case, contact, contribution, event, grant, membership, and pledge are supported. |
77855840 TO |
781 | * @param array $tasks |
782 | * The current set of tasks for that custom field. | |
6a488035 | 783 | * You can add/remove existing tasks. |
7f82e636 | 784 | * Each task needs to have a title (eg 'title' => ts( 'Group - add contacts')) and a class |
9399901d | 785 | * (eg 'class' => 'CRM_Contact_Form_Task_AddToGroup'). |
6a488035 | 786 | * Optional result (boolean) may also be provided. Class can be an array of classes (not sure what that does :( ). |
9399901d KJ |
787 | * The key for new Task(s) should not conflict with the keys for core tasks of that $objectType, which can be |
788 | * found in CRM/$objectType/Task.php. | |
72536736 AH |
789 | * |
790 | * @return mixed | |
6a488035 | 791 | */ |
00be9182 | 792 | public static function searchTasks($objectType, &$tasks) { |
6a488035 | 793 | return self::singleton()->invoke(2, $objectType, $tasks, |
87dab4a4 | 794 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
795 | 'civicrm_searchTasks' |
796 | ); | |
797 | } | |
798 | ||
72536736 AH |
799 | /** |
800 | * @param mixed $form | |
801 | * @param array $params | |
802 | * | |
803 | * @return mixed | |
804 | */ | |
00be9182 | 805 | public static function eventDiscount(&$form, &$params) { |
6a488035 | 806 | return self::singleton()->invoke(2, $form, $params, |
87dab4a4 | 807 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
808 | 'civicrm_eventDiscount' |
809 | ); | |
810 | } | |
811 | ||
812 | /** | |
813 | * This hook is called when composing a mailing. You can include / exclude other groups as needed. | |
814 | * | |
72536736 AH |
815 | * @param mixed $form |
816 | * The form object for which groups / mailings being displayed | |
817 | * @param array $groups | |
818 | * The list of groups being included / excluded | |
819 | * @param array $mailings | |
820 | * The list of mailings being included / excluded | |
821 | * | |
822 | * @return mixed | |
6a488035 | 823 | */ |
00be9182 | 824 | public static function mailingGroups(&$form, &$groups, &$mailings) { |
6a488035 | 825 | return self::singleton()->invoke(3, $form, $groups, $mailings, |
87dab4a4 | 826 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
827 | 'civicrm_mailingGroups' |
828 | ); | |
829 | } | |
830 | ||
831 | /** | |
9399901d KJ |
832 | * This hook is called when composing the array of membershipTypes and their cost during a membership registration |
833 | * (new or renewal). | |
6a488035 TO |
834 | * Note the hook is called on initial page load and also reloaded after submit (PRG pattern). |
835 | * You can use it to alter the membership types when first loaded, or after submission | |
836 | * (for example if you want to gather data in the form and use it to alter the fees). | |
837 | * | |
72536736 AH |
838 | * @param mixed $form |
839 | * The form object that is presenting the page | |
840 | * @param array $membershipTypes | |
841 | * The array of membership types and their amount | |
842 | * | |
843 | * @return mixed | |
6a488035 | 844 | */ |
00be9182 | 845 | public static function membershipTypeValues(&$form, &$membershipTypes) { |
6a488035 | 846 | return self::singleton()->invoke(2, $form, $membershipTypes, |
87dab4a4 | 847 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
848 | 'civicrm_membershipTypeValues' |
849 | ); | |
850 | } | |
851 | ||
852 | /** | |
fe482240 | 853 | * This hook is called when rendering the contact summary. |
6a488035 | 854 | * |
72536736 AH |
855 | * @param int $contactID |
856 | * The contactID for whom the summary is being rendered | |
857 | * @param mixed $content | |
858 | * @param int $contentPlacement | |
859 | * Specifies where the hook content should be displayed relative to the | |
860 | * existing content | |
6a488035 | 861 | * |
72536736 AH |
862 | * @return string |
863 | * The html snippet to include in the contact summary | |
6a488035 | 864 | */ |
00be9182 | 865 | public static function summary($contactID, &$content, &$contentPlacement = self::SUMMARY_BELOW) { |
6a488035 | 866 | return self::singleton()->invoke(3, $contactID, $content, $contentPlacement, |
87dab4a4 | 867 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
868 | 'civicrm_summary' |
869 | ); | |
870 | } | |
871 | ||
872 | /** | |
873 | * Use this hook to populate the list of contacts returned by Contact Reference custom fields. | |
874 | * By default, Contact Reference fields will search on and return all CiviCRM contacts. | |
875 | * If you want to limit the contacts returned to a specific group, or some other criteria | |
876 | * - you can override that behavior by providing a SQL query that returns some subset of your contacts. | |
877 | * The hook is called when the query is executed to get the list of contacts to display. | |
878 | * | |
77855840 TO |
879 | * @param mixed $query |
880 | * - the query that will be executed (input and output parameter);. | |
6a488035 TO |
881 | * It's important to realize that the ACL clause is built prior to this hook being fired, |
882 | * so your query will ignore any ACL rules that may be defined. | |
883 | * Your query must return two columns: | |
884 | * the contact 'data' to display in the autocomplete dropdown (usually contact.sort_name - aliased as 'data') | |
885 | * the contact IDs | |
77855840 TO |
886 | * @param string $name |
887 | * The name string to execute the query against (this is the value being typed in by the user). | |
888 | * @param string $context | |
889 | * The context in which this ajax call is being made (for example: 'customfield', 'caseview'). | |
890 | * @param int $id | |
891 | * The id of the object for which the call is being made. | |
6a488035 | 892 | * For custom fields, it will be the custom field id |
72536736 AH |
893 | * |
894 | * @return mixed | |
6a488035 | 895 | */ |
00be9182 | 896 | public static function contactListQuery(&$query, $name, $context, $id) { |
6a488035 | 897 | return self::singleton()->invoke(4, $query, $name, $context, $id, |
87dab4a4 | 898 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
899 | 'civicrm_contactListQuery' |
900 | ); | |
901 | } | |
902 | ||
903 | /** | |
904 | * Hook definition for altering payment parameters before talking to a payment processor back end. | |
905 | * | |
906 | * Definition will look like this: | |
907 | * | |
153b262f EM |
908 | * function hook_civicrm_alterPaymentProcessorParams( |
909 | * $paymentObj, | |
910 | * &$rawParams, | |
911 | * &$cookedParams | |
912 | * ); | |
80bcd255 | 913 | * |
153b262f EM |
914 | * @param CRM_Core_Payment $paymentObj |
915 | * Instance of payment class of the payment processor invoked (e.g., 'CRM_Core_Payment_Dummy') | |
916 | * See discussion in CRM-16224 as to whether $paymentObj should be passed by reference. | |
6a488035 TO |
917 | * @param array &$rawParams |
918 | * array of params as passed to to the processor | |
72536736 | 919 | * @param array &$cookedParams |
6a488035 TO |
920 | * params after the processor code has translated them into its own key/value pairs |
921 | * | |
72536736 | 922 | * @return mixed |
80bcd255 | 923 | * This return is not really intended to be used. |
6a488035 | 924 | */ |
37cd2432 | 925 | public static function alterPaymentProcessorParams( |
a3e55d9c | 926 | $paymentObj, |
6a488035 TO |
927 | &$rawParams, |
928 | &$cookedParams | |
929 | ) { | |
930 | return self::singleton()->invoke(3, $paymentObj, $rawParams, $cookedParams, | |
87dab4a4 | 931 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
932 | 'civicrm_alterPaymentProcessorParams' |
933 | ); | |
934 | } | |
935 | ||
936 | /** | |
937 | * This hook is called when an email is about to be sent by CiviCRM. | |
938 | * | |
72536736 AH |
939 | * @param array $params |
940 | * Array fields include: groupName, from, toName, toEmail, subject, cc, bcc, text, html, | |
16b10e64 | 941 | * returnPath, replyTo, headers, attachments (array) |
77855840 TO |
942 | * @param string $context |
943 | * The context in which the hook is being invoked, eg 'civimail'. | |
72536736 AH |
944 | * |
945 | * @return mixed | |
6a488035 | 946 | */ |
00be9182 | 947 | public static function alterMailParams(&$params, $context = NULL) { |
6a488035 | 948 | return self::singleton()->invoke(2, $params, $context, |
87dab4a4 | 949 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
950 | 'civicrm_alterMailParams' |
951 | ); | |
952 | } | |
953 | ||
5f11bbcc | 954 | /** |
fe482240 | 955 | * This hook is called when membership status is being calculated. |
5f11bbcc | 956 | * |
77855840 TO |
957 | * @param array $membershipStatus |
958 | * Membership status details as determined - alter if required. | |
959 | * @param array $arguments | |
960 | * Arguments passed in to calculate date. | |
5f11bbcc EM |
961 | * - 'start_date' |
962 | * - 'end_date' | |
963 | * - 'status_date' | |
964 | * - 'join_date' | |
965 | * - 'exclude_is_admin' | |
966 | * - 'membership_type_id' | |
77855840 TO |
967 | * @param array $membership |
968 | * Membership details from the calling function. | |
f4aaa82a EM |
969 | * |
970 | * @return mixed | |
5f11bbcc | 971 | */ |
00be9182 | 972 | public static function alterCalculatedMembershipStatus(&$membershipStatus, $arguments, $membership) { |
5f11bbcc | 973 | return self::singleton()->invoke(3, $membershipStatus, $arguments, |
fc6a608f | 974 | $membership, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
5f11bbcc EM |
975 | 'civicrm_alterCalculatedMembershipStatus' |
976 | ); | |
977 | } | |
978 | ||
6a488035 | 979 | /** |
fe482240 | 980 | * This hook is called when rendering the Manage Case screen. |
6a488035 | 981 | * |
77855840 TO |
982 | * @param int $caseID |
983 | * The case ID. | |
6a488035 | 984 | * |
a6c01b45 | 985 | * @return array |
16b10e64 CW |
986 | * Array of data to be displayed, where the key is a unique id to be used for styling (div id's) |
987 | * and the value is an array with keys 'label' and 'value' specifying label/value pairs | |
6a488035 | 988 | */ |
00be9182 | 989 | public static function caseSummary($caseID) { |
6a488035 | 990 | return self::singleton()->invoke(1, $caseID, |
87dab4a4 | 991 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
992 | 'civicrm_caseSummary' |
993 | ); | |
994 | } | |
995 | ||
6b86870e TO |
996 | /** |
997 | * This hook is called when locating CiviCase types. | |
998 | * | |
999 | * @param array $caseTypes | |
72536736 AH |
1000 | * |
1001 | * @return mixed | |
6b86870e | 1002 | */ |
00be9182 | 1003 | public static function caseTypes(&$caseTypes) { |
37cd2432 TO |
1004 | return self::singleton() |
1005 | ->invoke(1, $caseTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_caseTypes'); | |
6b86870e TO |
1006 | } |
1007 | ||
6a488035 TO |
1008 | /** |
1009 | * This hook is called soon after the CRM_Core_Config object has ben initialized. | |
1010 | * You can use this hook to modify the config object and hence behavior of CiviCRM dynamically. | |
72536736 AH |
1011 | * |
1012 | * @param CRM_Core_Config|array $config | |
1013 | * The config object | |
1014 | * | |
1015 | * @return mixed | |
6a488035 | 1016 | */ |
00be9182 | 1017 | public static function config(&$config) { |
6a488035 | 1018 | return self::singleton()->invoke(1, $config, |
87dab4a4 | 1019 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1020 | 'civicrm_config' |
1021 | ); | |
1022 | } | |
1023 | ||
6a488035 | 1024 | /** |
fe482240 | 1025 | * This hooks allows to change option values. |
6a488035 | 1026 | * |
72536736 AH |
1027 | * @param array $options |
1028 | * Associated array of option values / id | |
1029 | * @param string $name | |
1030 | * Option group name | |
6a488035 | 1031 | * |
72536736 | 1032 | * @return mixed |
6a488035 | 1033 | */ |
00be9182 | 1034 | public static function optionValues(&$options, $name) { |
6a488035 | 1035 | return self::singleton()->invoke(2, $options, $name, |
87dab4a4 | 1036 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1037 | 'civicrm_optionValues' |
1038 | ); | |
1039 | } | |
1040 | ||
1041 | /** | |
1042 | * This hook allows modification of the navigation menu. | |
1043 | * | |
72536736 AH |
1044 | * @param array $params |
1045 | * Associated array of navigation menu entry to Modify/Add | |
1046 | * | |
1047 | * @return mixed | |
6a488035 | 1048 | */ |
00be9182 | 1049 | public static function navigationMenu(&$params) { |
6a488035 | 1050 | return self::singleton()->invoke(1, $params, |
87dab4a4 | 1051 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1052 | 'civicrm_navigationMenu' |
1053 | ); | |
1054 | } | |
1055 | ||
1056 | /** | |
1057 | * This hook allows modification of the data used to perform merging of duplicates. | |
1058 | * | |
77855840 TO |
1059 | * @param string $type |
1060 | * The type of data being passed (cidRefs|eidRefs|relTables|sqls). | |
1061 | * @param array $data | |
1062 | * The data, as described in $type. | |
1063 | * @param int $mainId | |
1064 | * Contact_id of the contact that survives the merge. | |
1065 | * @param int $otherId | |
1066 | * Contact_id of the contact that will be absorbed and deleted. | |
1067 | * @param array $tables | |
1068 | * When $type is "sqls", an array of tables as it may have been handed to the calling function. | |
6a488035 | 1069 | * |
72536736 | 1070 | * @return mixed |
6a488035 | 1071 | */ |
00be9182 | 1072 | public static function merge($type, &$data, $mainId = NULL, $otherId = NULL, $tables = NULL) { |
87dab4a4 | 1073 | return self::singleton()->invoke(5, $type, $data, $mainId, $otherId, $tables, self::$_nullObject, 'civicrm_merge'); |
6a488035 TO |
1074 | } |
1075 | ||
1076 | /** | |
1077 | * This hook provides a way to override the default privacy behavior for notes. | |
1078 | * | |
72536736 AH |
1079 | * @param array &$noteValues |
1080 | * Associative array of values for this note | |
6a488035 | 1081 | * |
72536736 | 1082 | * @return mixed |
6a488035 | 1083 | */ |
00be9182 | 1084 | public static function notePrivacy(&$noteValues) { |
6a488035 | 1085 | return self::singleton()->invoke(1, $noteValues, |
87dab4a4 | 1086 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1087 | 'civicrm_notePrivacy' |
1088 | ); | |
1089 | } | |
1090 | ||
1091 | /** | |
fe482240 | 1092 | * This hook is called before record is exported as CSV. |
6a488035 | 1093 | * |
77855840 TO |
1094 | * @param string $exportTempTable |
1095 | * Name of the temporary export table used during export. | |
1096 | * @param array $headerRows | |
1097 | * Header rows for output. | |
1098 | * @param array $sqlColumns | |
1099 | * SQL columns. | |
1100 | * @param int $exportMode | |
1101 | * Export mode ( contact, contribution, etc...). | |
6a488035 | 1102 | * |
72536736 | 1103 | * @return mixed |
6a488035 | 1104 | */ |
00be9182 | 1105 | public static function export(&$exportTempTable, &$headerRows, &$sqlColumns, &$exportMode) { |
6a488035 | 1106 | return self::singleton()->invoke(4, $exportTempTable, $headerRows, $sqlColumns, $exportMode, |
87dab4a4 | 1107 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1108 | 'civicrm_export' |
1109 | ); | |
1110 | } | |
1111 | ||
1112 | /** | |
1113 | * This hook allows modification of the queries constructed from dupe rules. | |
1114 | * | |
77855840 TO |
1115 | * @param string $obj |
1116 | * Object of rulegroup class. | |
1117 | * @param string $type | |
1118 | * Type of queries e.g table / threshold. | |
1119 | * @param array $query | |
1120 | * Set of queries. | |
6a488035 | 1121 | * |
f4aaa82a | 1122 | * @return mixed |
6a488035 | 1123 | */ |
00be9182 | 1124 | public static function dupeQuery($obj, $type, &$query) { |
6a488035 | 1125 | return self::singleton()->invoke(3, $obj, $type, $query, |
87dab4a4 | 1126 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1127 | 'civicrm_dupeQuery' |
1128 | ); | |
1129 | } | |
1130 | ||
1131 | /** | |
1132 | * This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php | |
1133 | * | |
77855840 TO |
1134 | * @param string $type |
1135 | * Type of mail processed: 'activity' OR 'mailing'. | |
f4aaa82a | 1136 | * @param array &$params the params that were sent to the CiviCRM API function |
77855840 TO |
1137 | * @param object $mail |
1138 | * The mail object which is an ezcMail class. | |
f4aaa82a | 1139 | * @param array &$result the result returned by the api call |
77855840 TO |
1140 | * @param string $action |
1141 | * (optional ) the requested action to be performed if the types was 'mailing'. | |
6a488035 | 1142 | * |
f4aaa82a | 1143 | * @return mixed |
6a488035 | 1144 | */ |
00be9182 | 1145 | public static function emailProcessor($type, &$params, $mail, &$result, $action = NULL) { |
37cd2432 TO |
1146 | return self::singleton() |
1147 | ->invoke(5, $type, $params, $mail, $result, $action, self::$_nullObject, 'civicrm_emailProcessor'); | |
6a488035 TO |
1148 | } |
1149 | ||
1150 | /** | |
1151 | * This hook is called after a row has been processed and the | |
1152 | * record (and associated records imported | |
1153 | * | |
77855840 TO |
1154 | * @param string $object |
1155 | * Object being imported (for now Contact only, later Contribution, Activity,. | |
9399901d | 1156 | * Participant and Member) |
77855840 TO |
1157 | * @param string $usage |
1158 | * Hook usage/location (for now process only, later mapping and others). | |
1159 | * @param string $objectRef | |
1160 | * Import record object. | |
1161 | * @param array $params | |
1162 | * Array with various key values: currently. | |
6a488035 TO |
1163 | * contactID - contact id |
1164 | * importID - row id in temp table | |
1165 | * importTempTable - name of tempTable | |
1166 | * fieldHeaders - field headers | |
1167 | * fields - import fields | |
1168 | * | |
b8c71ffa | 1169 | * @return mixed |
6a488035 | 1170 | */ |
00be9182 | 1171 | public static function import($object, $usage, &$objectRef, &$params) { |
6a488035 | 1172 | return self::singleton()->invoke(4, $object, $usage, $objectRef, $params, |
87dab4a4 | 1173 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1174 | 'civicrm_import' |
1175 | ); | |
1176 | } | |
1177 | ||
1178 | /** | |
1179 | * This hook is called when API permissions are checked (cf. civicrm_api3_api_check_permission() | |
aa5ba569 | 1180 | * in api/v3/utils.php and _civicrm_api3_permissions() in CRM/Core/DAO/permissions.php). |
6a488035 | 1181 | * |
77855840 TO |
1182 | * @param string $entity |
1183 | * The API entity (like contact). | |
1184 | * @param string $action | |
1185 | * The API action (like get). | |
f4aaa82a | 1186 | * @param array &$params the API parameters |
c490a46a | 1187 | * @param array &$permissions the associative permissions array (probably to be altered by this hook) |
f4aaa82a EM |
1188 | * |
1189 | * @return mixed | |
6a488035 | 1190 | */ |
00be9182 | 1191 | public static function alterAPIPermissions($entity, $action, &$params, &$permissions) { |
6a488035 | 1192 | return self::singleton()->invoke(4, $entity, $action, $params, $permissions, |
87dab4a4 | 1193 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1194 | 'civicrm_alterAPIPermissions' |
1195 | ); | |
1196 | } | |
1197 | ||
5bc392e6 | 1198 | /** |
c490a46a | 1199 | * @param CRM_Core_DAO $dao |
5bc392e6 EM |
1200 | * |
1201 | * @return mixed | |
1202 | */ | |
00be9182 | 1203 | public static function postSave(&$dao) { |
6a488035 TO |
1204 | $hookName = 'civicrm_postSave_' . $dao->getTableName(); |
1205 | return self::singleton()->invoke(1, $dao, | |
87dab4a4 | 1206 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1207 | $hookName |
1208 | ); | |
1209 | } | |
1210 | ||
1211 | /** | |
1212 | * This hook allows user to customize context menu Actions on contact summary page. | |
1213 | * | |
77855840 TO |
1214 | * @param array $actions |
1215 | * Array of all Actions in contextmenu. | |
1216 | * @param int $contactID | |
1217 | * ContactID for the summary page. | |
f4aaa82a EM |
1218 | * |
1219 | * @return mixed | |
6a488035 | 1220 | */ |
00be9182 | 1221 | public static function summaryActions(&$actions, $contactID = NULL) { |
6a488035 | 1222 | return self::singleton()->invoke(2, $actions, $contactID, |
87dab4a4 | 1223 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1224 | 'civicrm_summaryActions' |
1225 | ); | |
1226 | } | |
1227 | ||
1228 | /** | |
1229 | * This hook is called from CRM_Core_Selector_Controller through which all searches in civicrm go. | |
1230 | * This enables us hook implementors to modify both the headers and the rows | |
1231 | * | |
1232 | * The BIGGEST drawback with this hook is that you may need to modify the result template to include your | |
1233 | * fields. The result files are CRM/{Contact,Contribute,Member,Event...}/Form/Selector.tpl | |
1234 | * | |
1235 | * However, if you use the same number of columns, you can overwrite the existing columns with the values that | |
1236 | * you want displayed. This is a hackish, but avoids template modification. | |
1237 | * | |
77855840 TO |
1238 | * @param string $objectName |
1239 | * The component name that we are doing the search. | |
6a488035 | 1240 | * activity, campaign, case, contact, contribution, event, grant, membership, and pledge |
f4aaa82a EM |
1241 | * @param array &$headers the list of column headers, an associative array with keys: ( name, sort, order ) |
1242 | * @param array &$rows the list of values, an associate array with fields that are displayed for that component | |
16b10e64 CW |
1243 | * @param array $selector |
1244 | * the selector object. Allows you access to the context of the search | |
6a488035 | 1245 | * |
b8c71ffa | 1246 | * @return mixed |
a6c01b45 | 1247 | * modify the header and values object to pass the data u need |
6a488035 | 1248 | */ |
00be9182 | 1249 | public static function searchColumns($objectName, &$headers, &$rows, &$selector) { |
6a488035 | 1250 | return self::singleton()->invoke(4, $objectName, $headers, $rows, $selector, |
87dab4a4 | 1251 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1252 | 'civicrm_searchColumns' |
1253 | ); | |
1254 | } | |
1255 | ||
1256 | /** | |
1257 | * This hook is called when uf groups are being built for a module. | |
1258 | * | |
77855840 TO |
1259 | * @param string $moduleName |
1260 | * Module name. | |
1261 | * @param array $ufGroups | |
1262 | * Array of ufgroups for a module. | |
6a488035 TO |
1263 | * |
1264 | * @return null | |
6a488035 | 1265 | */ |
00be9182 | 1266 | public static function buildUFGroupsForModule($moduleName, &$ufGroups) { |
6a488035 | 1267 | return self::singleton()->invoke(2, $moduleName, $ufGroups, |
87dab4a4 | 1268 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1269 | 'civicrm_buildUFGroupsForModule' |
1270 | ); | |
1271 | } | |
1272 | ||
1273 | /** | |
1274 | * This hook is called when we are determining the contactID for a specific | |
1275 | * email address | |
1276 | * | |
77855840 TO |
1277 | * @param string $email |
1278 | * The email address. | |
1279 | * @param int $contactID | |
1280 | * The contactID that matches this email address, IF it exists. | |
1281 | * @param array $result | |
1282 | * (reference) has two fields. | |
6a488035 TO |
1283 | * contactID - the new (or same) contactID |
1284 | * action - 3 possible values: | |
9399901d KJ |
1285 | * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_CREATE_INDIVIDUAL - create a new contact record |
1286 | * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_OVERRIDE - use the new contactID | |
1287 | * CRM_Utils_Mail_Incoming::EMAILPROCESSOR_IGNORE - skip this email address | |
6a488035 TO |
1288 | * |
1289 | * @return null | |
6a488035 | 1290 | */ |
00be9182 | 1291 | public static function emailProcessorContact($email, $contactID, &$result) { |
6a488035 | 1292 | return self::singleton()->invoke(3, $email, $contactID, $result, |
87dab4a4 | 1293 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1294 | 'civicrm_emailProcessorContact' |
1295 | ); | |
1296 | } | |
1297 | ||
1298 | /** | |
fe482240 | 1299 | * Hook definition for altering the generation of Mailing Labels. |
6a488035 | 1300 | * |
77855840 TO |
1301 | * @param array $args |
1302 | * An array of the args in the order defined for the tcpdf multiCell api call. | |
6a488035 TO |
1303 | * with the variable names below converted into string keys (ie $w become 'w' |
1304 | * as the first key for $args) | |
1305 | * float $w Width of cells. If 0, they extend up to the right margin of the page. | |
1306 | * float $h Cell minimum height. The cell extends automatically if needed. | |
1307 | * string $txt String to print | |
1308 | * mixed $border Indicates if borders must be drawn around the cell block. The value can | |
1309 | * be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or | |
1310 | * a string containing some or all of the following characters (in any order): | |
1311 | * <ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> | |
1312 | * string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: | |
1313 | * left align</li><li>C: center</li><li>R: right align</li><li>J: justification | |
1314 | * (default value when $ishtml=false)</li></ul> | |
1315 | * int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. | |
1316 | * int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: | |
1317 | * to the right</li><li>1: to the beginning of the next line [DEFAULT]</li><li>2: below</li></ul> | |
1318 | * float $x x position in user units | |
1319 | * float $y y position in user units | |
1320 | * boolean $reseth if true reset the last cell height (default true). | |
b44e3f84 | 1321 | * int $stretch stretch character mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if |
6a488035 TO |
1322 | * necessary</li><li>2 = forced horizontal scaling</li><li>3 = character spacing only if |
1323 | * necessary</li><li>4 = forced character spacing</li></ul> | |
1324 | * boolean $ishtml set to true if $txt is HTML content (default = false). | |
1325 | * boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width. | |
1326 | * float $maxh maximum height. It should be >= $h and less then remaining space to the bottom of the page, | |
1327 | * or 0 for disable this feature. This feature works only when $ishtml=false. | |
1328 | * | |
f4aaa82a | 1329 | * @return mixed |
6a488035 | 1330 | */ |
00be9182 | 1331 | public static function alterMailingLabelParams(&$args) { |
6a488035 TO |
1332 | return self::singleton()->invoke(1, $args, |
1333 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1334 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1335 | 'civicrm_alterMailingLabelParams' |
1336 | ); | |
1337 | } | |
1338 | ||
1339 | /** | |
fe482240 | 1340 | * This hooks allows alteration of generated page content. |
6a488035 | 1341 | * |
77855840 TO |
1342 | * @param $content |
1343 | * Previously generated content. | |
1344 | * @param $context | |
1345 | * Context of content - page or form. | |
1346 | * @param $tplName | |
1347 | * The file name of the tpl. | |
1348 | * @param $object | |
1349 | * A reference to the page or form object. | |
6a488035 | 1350 | * |
f4aaa82a | 1351 | * @return mixed |
6a488035 | 1352 | */ |
00be9182 | 1353 | public static function alterContent(&$content, $context, $tplName, &$object) { |
6a488035 | 1354 | return self::singleton()->invoke(4, $content, $context, $tplName, $object, |
87dab4a4 | 1355 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1356 | 'civicrm_alterContent' |
1357 | ); | |
1358 | } | |
1359 | ||
8aac22c8 | 1360 | /** |
1361 | * This hooks allows alteration of the tpl file used to generate content. It differs from the | |
1362 | * altercontent hook as the content has already been rendered through the tpl at that point | |
1363 | * | |
77855840 TO |
1364 | * @param $formName |
1365 | * Previously generated content. | |
1366 | * @param $form | |
1367 | * Reference to the form object. | |
1368 | * @param $context | |
1369 | * Context of content - page or form. | |
1370 | * @param $tplName | |
1371 | * Reference the file name of the tpl. | |
8aac22c8 | 1372 | * |
f4aaa82a | 1373 | * @return mixed |
8aac22c8 | 1374 | */ |
00be9182 | 1375 | public static function alterTemplateFile($formName, &$form, $context, &$tplName) { |
8aac22c8 | 1376 | return self::singleton()->invoke(4, $formName, $form, $context, $tplName, |
87dab4a4 | 1377 | self::$_nullObject, self::$_nullObject, |
8aac22c8 | 1378 | 'civicrm_alterTemplateFile' |
1379 | ); | |
1380 | } | |
f4aaa82a | 1381 | |
6a488035 | 1382 | /** |
fe482240 | 1383 | * This hook collects the trigger definition from all components. |
6a488035 | 1384 | * |
f4aaa82a | 1385 | * @param $info |
77855840 TO |
1386 | * @param string $tableName |
1387 | * (optional) the name of the table that we are interested in only. | |
f4aaa82a EM |
1388 | * |
1389 | * @internal param \reference $triggerInfo to an array of trigger information | |
6a488035 TO |
1390 | * each element has 4 fields: |
1391 | * table - array of tableName | |
1392 | * when - BEFORE or AFTER | |
1393 | * event - array of eventName - INSERT OR UPDATE OR DELETE | |
1394 | * sql - array of statements optionally terminated with a ; | |
1395 | * a statement can use the tokes {tableName} and {eventName} | |
1396 | * to do token replacement with the table / event. This allows | |
1397 | * templatizing logging and other hooks | |
f4aaa82a | 1398 | * @return mixed |
6a488035 | 1399 | */ |
00be9182 | 1400 | public static function triggerInfo(&$info, $tableName = NULL) { |
6a488035 | 1401 | return self::singleton()->invoke(2, $info, $tableName, |
87dab4a4 | 1402 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1403 | self::$_nullObject, |
1404 | 'civicrm_triggerInfo' | |
1405 | ); | |
1406 | } | |
1407 | ||
1408 | /** | |
1409 | * This hook is called when a module-extension is installed. | |
9399901d KJ |
1410 | * Each module will receive hook_civicrm_install during its own installation (but not during the |
1411 | * installation of unrelated modules). | |
6a488035 | 1412 | */ |
00be9182 | 1413 | public static function install() { |
6a488035 TO |
1414 | return self::singleton()->invoke(0, self::$_nullObject, |
1415 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1416 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1417 | 'civicrm_install' |
1418 | ); | |
1419 | } | |
1420 | ||
1421 | /** | |
1422 | * This hook is called when a module-extension is uninstalled. | |
9399901d KJ |
1423 | * Each module will receive hook_civicrm_uninstall during its own uninstallation (but not during the |
1424 | * uninstallation of unrelated modules). | |
6a488035 | 1425 | */ |
00be9182 | 1426 | public static function uninstall() { |
6a488035 TO |
1427 | return self::singleton()->invoke(0, self::$_nullObject, |
1428 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1429 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1430 | 'civicrm_uninstall' |
1431 | ); | |
1432 | } | |
1433 | ||
1434 | /** | |
1435 | * This hook is called when a module-extension is re-enabled. | |
9399901d KJ |
1436 | * Each module will receive hook_civicrm_enable during its own re-enablement (but not during the |
1437 | * re-enablement of unrelated modules). | |
6a488035 | 1438 | */ |
00be9182 | 1439 | public static function enable() { |
6a488035 TO |
1440 | return self::singleton()->invoke(0, self::$_nullObject, |
1441 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1442 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1443 | 'civicrm_enable' |
1444 | ); | |
1445 | } | |
1446 | ||
1447 | /** | |
1448 | * This hook is called when a module-extension is disabled. | |
9399901d KJ |
1449 | * Each module will receive hook_civicrm_disable during its own disablement (but not during the |
1450 | * disablement of unrelated modules). | |
6a488035 | 1451 | */ |
00be9182 | 1452 | public static function disable() { |
6a488035 TO |
1453 | return self::singleton()->invoke(0, self::$_nullObject, |
1454 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1455 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1456 | 'civicrm_disable' |
1457 | ); | |
1458 | } | |
1459 | ||
5bc392e6 EM |
1460 | /** |
1461 | * @param $varType | |
1462 | * @param $var | |
1463 | * @param $object | |
1464 | * | |
1465 | * @return mixed | |
1466 | */ | |
00be9182 | 1467 | public static function alterReportVar($varType, &$var, &$object) { |
6a488035 TO |
1468 | return self::singleton()->invoke(3, $varType, $var, $object, |
1469 | self::$_nullObject, | |
87dab4a4 | 1470 | self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1471 | 'civicrm_alterReportVar' |
1472 | ); | |
1473 | } | |
1474 | ||
1475 | /** | |
1476 | * This hook is called to drive database upgrades for extension-modules. | |
1477 | * | |
72536736 AH |
1478 | * @param string $op |
1479 | * The type of operation being performed; 'check' or 'enqueue'. | |
1480 | * @param CRM_Queue_Queue $queue | |
1481 | * (for 'enqueue') the modifiable list of pending up upgrade tasks. | |
6a488035 | 1482 | * |
72536736 AH |
1483 | * @return bool|null |
1484 | * NULL, if $op is 'enqueue'. | |
1485 | * TRUE, if $op is 'check' and upgrades are pending. | |
1486 | * FALSE, if $op is 'check' and upgrades are not pending. | |
6a488035 | 1487 | */ |
00be9182 | 1488 | public static function upgrade($op, CRM_Queue_Queue $queue = NULL) { |
6a488035 | 1489 | return self::singleton()->invoke(2, $op, $queue, |
87dab4a4 | 1490 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1491 | self::$_nullObject, |
1492 | 'civicrm_upgrade' | |
1493 | ); | |
1494 | } | |
1495 | ||
1496 | /** | |
1497 | * This hook is called when an email has been successfully sent by CiviCRM, but not on an error. | |
1498 | * | |
72536736 AH |
1499 | * @param array $params |
1500 | * The mailing parameters. Array fields include: groupName, from, toName, | |
1501 | * toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers, | |
1502 | * attachments (array) | |
1503 | * | |
1504 | * @return mixed | |
6a488035 | 1505 | */ |
00be9182 | 1506 | public static function postEmailSend(&$params) { |
6a488035 TO |
1507 | return self::singleton()->invoke(1, $params, |
1508 | self::$_nullObject, self::$_nullObject, | |
87dab4a4 | 1509 | self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1510 | 'civicrm_postEmailSend' |
1511 | ); | |
1512 | } | |
1513 | ||
1514 | /** | |
fe482240 | 1515 | * This hook is called when Settings specifications are loaded. |
6a488035 | 1516 | * |
72536736 AH |
1517 | * @param array $settingsFolders |
1518 | * List of paths from which to derive metadata | |
1519 | * | |
1520 | * @return mixed | |
6a488035 | 1521 | */ |
00be9182 | 1522 | public static function alterSettingsFolders(&$settingsFolders) { |
6a488035 | 1523 | return self::singleton()->invoke(1, $settingsFolders, |
37cd2432 TO |
1524 | self::$_nullObject, self::$_nullObject, |
1525 | self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1526 | 'civicrm_alterSettingsFolders' | |
6a488035 TO |
1527 | ); |
1528 | } | |
1529 | ||
1530 | /** | |
1531 | * This hook is called when Settings have been loaded from the xml | |
1532 | * It is an opportunity for hooks to alter the data | |
1533 | * | |
77855840 TO |
1534 | * @param array $settingsMetaData |
1535 | * Settings Metadata. | |
72536736 AH |
1536 | * @param int $domainID |
1537 | * @param mixed $profile | |
1538 | * | |
1539 | * @return mixed | |
6a488035 | 1540 | */ |
00be9182 | 1541 | public static function alterSettingsMetaData(&$settingsMetaData, $domainID, $profile) { |
6a488035 | 1542 | return self::singleton()->invoke(3, $settingsMetaData, |
37cd2432 TO |
1543 | $domainID, $profile, |
1544 | self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1545 | 'civicrm_alterSettingsMetaData' | |
6a488035 TO |
1546 | ); |
1547 | } | |
1548 | ||
5270c026 XD |
1549 | /** |
1550 | * This hook is called before running an api call. | |
1551 | * | |
72536736 AH |
1552 | * @param API_Wrapper[] $wrappers |
1553 | * (see CRM_Utils_API_ReloadOption as an example) | |
1554 | * @param mixed $apiRequest | |
5270c026 | 1555 | * |
72536736 AH |
1556 | * @return null |
1557 | * The return value is ignored | |
5270c026 | 1558 | */ |
00be9182 | 1559 | public static function apiWrappers(&$wrappers, $apiRequest) { |
09f8c8dc TO |
1560 | return self::singleton() |
1561 | ->invoke(2, $wrappers, $apiRequest, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
37cd2432 TO |
1562 | self::$_nullObject, 'civicrm_apiWrappers' |
1563 | ); | |
5270c026 XD |
1564 | } |
1565 | ||
6a488035 TO |
1566 | /** |
1567 | * This hook is called before running pending cron jobs. | |
1568 | * | |
1569 | * @param CRM_Core_JobManager $jobManager | |
1570 | * | |
72536736 AH |
1571 | * @return null |
1572 | * The return value is ignored. | |
6a488035 | 1573 | */ |
00be9182 | 1574 | public static function cron($jobManager) { |
6a488035 | 1575 | return self::singleton()->invoke(1, |
87dab4a4 | 1576 | $jobManager, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1577 | 'civicrm_cron' |
1578 | ); | |
1579 | } | |
1580 | ||
1581 | /** | |
1582 | * This hook is called when loading CMS permissions; use this hook to modify | |
1583 | * the array of system permissions for CiviCRM. | |
1584 | * | |
72536736 AH |
1585 | * @param array $permissions |
1586 | * Array of permissions. See CRM_Core_Permission::getCorePermissions() for | |
1587 | * the format of this array. | |
6a488035 | 1588 | * |
72536736 AH |
1589 | * @return null |
1590 | * The return value is ignored | |
6a488035 | 1591 | */ |
00be9182 | 1592 | public static function permission(&$permissions) { |
6a488035 | 1593 | return self::singleton()->invoke(1, $permissions, |
87dab4a4 | 1594 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
6a488035 TO |
1595 | 'civicrm_permission' |
1596 | ); | |
1597 | } | |
fed67e4d | 1598 | |
4b57bc9f EM |
1599 | /** |
1600 | * @param CRM_Core_Exception Exception $exception | |
77855840 TO |
1601 | * @param mixed $request |
1602 | * Reserved for future use. | |
4b57bc9f | 1603 | */ |
37cd2432 TO |
1604 | public static function unhandledException($exception, $request = NULL) { |
1605 | self::singleton() | |
1606 | ->invoke(2, $exception, $request, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_unhandled_exception'); | |
4caeca04 TO |
1607 | // == 4.4 == |
1608 | //$event = new stdClass(); | |
1609 | //$event->exception = $exception; | |
1610 | //CRM_Core_LegacyErrorHandler::handleException($event); | |
1611 | ||
665b4982 | 1612 | // == 4.5+ == |
4caeca04 TO |
1613 | $event = new \Civi\Core\Event\UnhandledExceptionEvent($exception, self::$_nullObject); |
1614 | \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_unhandled_exception", $event); | |
4b57bc9f | 1615 | } |
fed67e4d TO |
1616 | |
1617 | /** | |
fe482240 | 1618 | * This hook is called for declaring managed entities via API. |
fed67e4d | 1619 | * |
72536736 AH |
1620 | * @param array[] $entityTypes |
1621 | * List of entity types; each entity-type is an array with keys: | |
fed67e4d TO |
1622 | * - name: string, a unique short name (e.g. "ReportInstance") |
1623 | * - class: string, a PHP DAO class (e.g. "CRM_Report_DAO_Instance") | |
1624 | * - table: string, a SQL table name (e.g. "civicrm_report_instance") | |
1625 | * | |
72536736 AH |
1626 | * @return null |
1627 | * The return value is ignored | |
fed67e4d | 1628 | */ |
00be9182 | 1629 | public static function entityTypes(&$entityTypes) { |
9399901d | 1630 | return self::singleton()->invoke(1, $entityTypes, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1631 | self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_entityTypes' |
fed67e4d TO |
1632 | ); |
1633 | } | |
a8387f19 TO |
1634 | |
1635 | /** | |
fe482240 | 1636 | * This hook is called while preparing a profile form. |
a8387f19 TO |
1637 | * |
1638 | * @param string $name | |
72536736 | 1639 | * @return mixed |
a8387f19 | 1640 | */ |
00be9182 | 1641 | public static function buildProfile($name) { |
9399901d | 1642 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1643 | self::$_nullObject, self::$_nullObject, 'civicrm_buildProfile'); |
a8387f19 TO |
1644 | } |
1645 | ||
1646 | /** | |
fe482240 | 1647 | * This hook is called while validating a profile form submission. |
a8387f19 TO |
1648 | * |
1649 | * @param string $name | |
72536736 | 1650 | * @return mixed |
a8387f19 | 1651 | */ |
00be9182 | 1652 | public static function validateProfile($name) { |
9399901d | 1653 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1654 | self::$_nullObject, self::$_nullObject, 'civicrm_validateProfile'); |
a8387f19 TO |
1655 | } |
1656 | ||
1657 | /** | |
fe482240 | 1658 | * This hook is called processing a valid profile form submission. |
a8387f19 TO |
1659 | * |
1660 | * @param string $name | |
72536736 | 1661 | * @return mixed |
a8387f19 | 1662 | */ |
00be9182 | 1663 | public static function processProfile($name) { |
9399901d | 1664 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1665 | self::$_nullObject, self::$_nullObject, 'civicrm_processProfile'); |
a8387f19 TO |
1666 | } |
1667 | ||
1668 | /** | |
1669 | * This hook is called while preparing a read-only profile screen | |
1670 | * | |
1671 | * @param string $name | |
72536736 | 1672 | * @return mixed |
a8387f19 | 1673 | */ |
00be9182 | 1674 | public static function viewProfile($name) { |
9399901d | 1675 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1676 | self::$_nullObject, self::$_nullObject, 'civicrm_viewProfile'); |
a8387f19 TO |
1677 | } |
1678 | ||
1679 | /** | |
1680 | * This hook is called while preparing a list of contacts (based on a profile) | |
1681 | * | |
1682 | * @param string $name | |
72536736 | 1683 | * @return mixed |
a8387f19 | 1684 | */ |
00be9182 | 1685 | public static function searchProfile($name) { |
9399901d | 1686 | return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, |
87dab4a4 | 1687 | self::$_nullObject, self::$_nullObject, 'civicrm_searchProfile'); |
9399901d KJ |
1688 | } |
1689 | ||
d0fc33e2 M |
1690 | /** |
1691 | * This hook is invoked when building a CiviCRM name badge. | |
1692 | * | |
77855840 TO |
1693 | * @param string $labelName |
1694 | * String referencing name of badge format. | |
1695 | * @param object $label | |
1696 | * Reference to the label object. | |
1697 | * @param array $format | |
1698 | * Array of format data. | |
1699 | * @param array $participant | |
1700 | * Array of participant values. | |
d0fc33e2 | 1701 | * |
a6c01b45 CW |
1702 | * @return null |
1703 | * the return value is ignored | |
d0fc33e2 | 1704 | */ |
00be9182 | 1705 | public static function alterBadge($labelName, &$label, &$format, &$participant) { |
37cd2432 TO |
1706 | return self::singleton() |
1707 | ->invoke(4, $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge'); | |
d0fc33e2 M |
1708 | } |
1709 | ||
1710 | ||
9399901d | 1711 | /** |
fe482240 | 1712 | * This hook is called before encoding data in barcode. |
9399901d | 1713 | * |
77855840 TO |
1714 | * @param array $data |
1715 | * Associated array of values available for encoding. | |
1716 | * @param string $type | |
1717 | * Type of barcode, classic barcode or QRcode. | |
1718 | * @param string $context | |
1719 | * Where this hooks is invoked. | |
9399901d | 1720 | * |
72536736 | 1721 | * @return mixed |
9399901d | 1722 | */ |
e7292422 | 1723 | public static function alterBarcode(&$data, $type = 'barcode', $context = 'name_badge') { |
9399901d | 1724 | return self::singleton()->invoke(3, $data, $type, $context, self::$_nullObject, |
87dab4a4 | 1725 | self::$_nullObject, self::$_nullObject, 'civicrm_alterBarcode'); |
a8387f19 | 1726 | } |
99e9587a | 1727 | |
72ad6c1b TO |
1728 | /** |
1729 | * Modify or replace the Mailer object used for outgoing mail. | |
1730 | * | |
1731 | * @param object $mailer | |
1732 | * The default mailer produced by normal configuration; a PEAR "Mail" class (like those returned by Mail::factory) | |
1733 | * @param string $driver | |
1734 | * The type of the default mailer (eg "smtp", "sendmail", "mock", "CRM_Mailing_BAO_Spool") | |
1735 | * @param array $params | |
1736 | * The default mailer config options | |
72536736 AH |
1737 | * |
1738 | * @return mixed | |
72ad6c1b TO |
1739 | * @see Mail::factory |
1740 | */ | |
00be9182 | 1741 | public static function alterMail(&$mailer, $driver, $params) { |
c8e4bea0 | 1742 | return self::singleton() |
87dab4a4 | 1743 | ->invoke(3, $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer'); |
72ad6c1b TO |
1744 | } |
1745 | ||
99e9587a | 1746 | /** |
2efcf0c2 | 1747 | * This hook is called while building the core search query, |
99e9587a DS |
1748 | * so hook implementers can provide their own query objects which alters/extends core search. |
1749 | * | |
72536736 AH |
1750 | * @param array $queryObjects |
1751 | * @param string $type | |
1752 | * | |
1753 | * @return mixed | |
99e9587a | 1754 | */ |
00be9182 | 1755 | public static function queryObjects(&$queryObjects, $type = 'Contact') { |
37cd2432 TO |
1756 | return self::singleton() |
1757 | ->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects'); | |
99e9587a | 1758 | } |
15d9b3ae N |
1759 | |
1760 | /** | |
fe482240 | 1761 | * This hook is called while viewing contact dashboard. |
15d9b3ae | 1762 | * |
72536736 AH |
1763 | * @param array $availableDashlets |
1764 | * List of dashlets; each is formatted per api/v3/Dashboard | |
1765 | * @param array $defaultDashlets | |
1766 | * List of dashlets; each is formatted per api/v3/DashboardContact | |
1767 | * | |
1768 | * @return mixed | |
15d9b3ae | 1769 | */ |
00be9182 | 1770 | public static function dashboard_defaults($availableDashlets, &$defaultDashlets) { |
37cd2432 TO |
1771 | return self::singleton() |
1772 | ->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults'); | |
15d9b3ae | 1773 | } |
02094cdb JJ |
1774 | |
1775 | /** | |
1776 | * This hook is called before a case merge (or a case reassign) | |
f4aaa82a | 1777 | * |
77855840 TO |
1778 | * @param int $mainContactId |
1779 | * @param int $mainCaseId | |
1780 | * @param int $otherContactId | |
1781 | * @param int $otherCaseId | |
3d0d359e | 1782 | * @param bool $changeClient |
f4aaa82a | 1783 | * |
b8c71ffa | 1784 | * @return mixed |
02094cdb | 1785 | */ |
00be9182 | 1786 | public static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) { |
37cd2432 TO |
1787 | return self::singleton() |
1788 | ->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_pre_case_merge'); | |
02094cdb | 1789 | } |
f4aaa82a | 1790 | |
02094cdb JJ |
1791 | /** |
1792 | * This hook is called after a case merge (or a case reassign) | |
f4aaa82a | 1793 | * |
77855840 TO |
1794 | * @param int $mainContactId |
1795 | * @param int $mainCaseId | |
1796 | * @param int $otherContactId | |
1797 | * @param int $otherCaseId | |
3d0d359e | 1798 | * @param bool $changeClient |
77b97be7 | 1799 | * |
b8c71ffa | 1800 | * @return mixed |
02094cdb | 1801 | */ |
00be9182 | 1802 | public static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) { |
37cd2432 TO |
1803 | return self::singleton() |
1804 | ->invoke(5, $mainContactId, $mainCaseId, $otherContactId, $otherCaseId, $changeClient, self::$_nullObject, 'civicrm_post_case_merge'); | |
02094cdb | 1805 | } |
250b3b1f | 1806 | |
1807 | /** | |
1808 | * Issue CRM-14276 | |
1809 | * Add a hook for altering the display name | |
1810 | * | |
1811 | * hook_civicrm_contact_get_displayname(&$display_name, $objContact) | |
f4aaa82a | 1812 | * |
250b3b1f | 1813 | * @param string $displayName |
1814 | * @param int $contactId | |
77855840 TO |
1815 | * @param object $dao |
1816 | * The contact object. | |
f4aaa82a EM |
1817 | * |
1818 | * @return mixed | |
250b3b1f | 1819 | */ |
267578ea | 1820 | public static function alterDisplayName(&$displayName, $contactId, $dao) { |
250b3b1f | 1821 | return self::singleton()->invoke(3, |
1822 | $displayName, $contactId, $dao, self::$_nullObject, self::$_nullObject, | |
1823 | self::$_nullObject, 'civicrm_contact_get_displayname' | |
1824 | ); | |
1825 | } | |
e7ff7042 TO |
1826 | |
1827 | /** | |
1828 | * EXPERIMENTAL: This hook allows one to register additional Angular modules | |
1829 | * | |
77855840 TO |
1830 | * @param array $angularModules |
1831 | * List of modules. | |
a6c01b45 CW |
1832 | * @return null |
1833 | * the return value is ignored | |
e7ff7042 TO |
1834 | * |
1835 | * @code | |
1836 | * function mymod_civicrm_angularModules(&$angularModules) { | |
8671b4f2 TO |
1837 | * $angularModules['myAngularModule'] = array( |
1838 | * 'ext' => 'org.example.mymod', | |
1839 | * 'js' => array('js/myAngularModule.js'), | |
1840 | * ); | |
1841 | * $angularModules['myBigAngularModule'] = array( | |
1842 | * 'ext' => 'org.example.mymod', | |
1843 | * 'js' => array('js/part1.js', 'js/part2.js'), | |
1844 | * 'css' => array('css/myAngularModule.css'), | |
1845 | * 'partials' => array('partials/myBigAngularModule'), | |
1846 | * ); | |
e7ff7042 TO |
1847 | * } |
1848 | * @endcode | |
1849 | */ | |
00be9182 | 1850 | public static function angularModules(&$angularModules) { |
e7ff7042 TO |
1851 | return self::singleton()->invoke(1, $angularModules, |
1852 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1853 | 'civicrm_angularModules' | |
1854 | ); | |
1855 | } | |
1856 | ||
708d8fa2 TO |
1857 | /** |
1858 | * This hook fires whenever a record in a case changes. | |
1859 | * | |
1860 | * @param \Civi\CCase\Analyzer $analyzer | |
1861 | */ | |
00be9182 | 1862 | public static function caseChange(\Civi\CCase\Analyzer $analyzer) { |
708d8fa2 TO |
1863 | $event = new \Civi\CCase\Event\CaseChangeEvent($analyzer); |
1864 | \Civi\Core\Container::singleton()->get('dispatcher')->dispatch("hook_civicrm_caseChange", $event); | |
1865 | ||
1866 | return self::singleton()->invoke(1, $angularModules, | |
1867 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1868 | 'civicrm_caseChange' | |
1869 | ); | |
1870 | } | |
688ad538 TO |
1871 | |
1872 | /** | |
fe482240 | 1873 | * Generate a default CRUD URL for an entity. |
688ad538 | 1874 | * |
77855840 TO |
1875 | * @param array $spec |
1876 | * With keys:. | |
688ad538 TO |
1877 | * - action: int, eg CRM_Core_Action::VIEW or CRM_Core_Action::UPDATE |
1878 | * - entity_table: string | |
1879 | * - entity_id: int | |
1880 | * @param CRM_Core_DAO $bao | |
77855840 TO |
1881 | * @param array $link |
1882 | * To define the link, add these keys to $link:. | |
16b10e64 CW |
1883 | * - title: string |
1884 | * - path: string | |
1885 | * - query: array | |
1886 | * - url: string (used in lieu of "path"/"query") | |
688ad538 TO |
1887 | * Note: if making "url" CRM_Utils_System::url(), set $htmlize=false |
1888 | * @return mixed | |
1889 | */ | |
00be9182 | 1890 | public static function crudLink($spec, $bao, &$link) { |
688ad538 TO |
1891 | return self::singleton()->invoke(3, $spec, $bao, $link, |
1892 | self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1893 | 'civicrm_crudLink' | |
1894 | ); | |
1895 | } | |
6cccc6d4 TO |
1896 | |
1897 | /** | |
37cd2432 | 1898 | * @param array <CRM_Core_FileSearchInterface> $fileSearches |
6cccc6d4 TO |
1899 | * @return mixed |
1900 | */ | |
00be9182 | 1901 | public static function fileSearches(&$fileSearches) { |
6cccc6d4 TO |
1902 | return self::singleton()->invoke(1, $fileSearches, |
1903 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1904 | 'civicrm_fileSearches' | |
1905 | ); | |
1906 | } | |
96025800 | 1907 | |
260e353b TO |
1908 | /** |
1909 | * Check system status. | |
1910 | * | |
1911 | * @param array $messages | |
1912 | * Array<CRM_Utils_Check_Message>. A list of messages regarding system status. | |
1913 | * @return mixed | |
1914 | */ | |
1915 | public static function check(&$messages) { | |
1916 | return self::singleton() | |
1917 | ->invoke(1, $messages, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_check'); | |
1918 | } | |
1919 | ||
75c8a3f7 GC |
1920 | /** |
1921 | * This hook is called when a query string of the CSV Batch export is generated. | |
1922 | */ | |
1923 | public static function batchQuery(&$query) { | |
1924 | return self::singleton()->invoke(1, $query, self::$_nullObject, | |
1925 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1926 | 'civicrm_batchQuery' | |
1927 | ); | |
1928 | } | |
1929 | ||
1930 | /** | |
1931 | * This hook is called when the entries of the CSV Batch export are mapped. | |
1932 | */ | |
1933 | public static function batchItems(&$results, &$items) { | |
1934 | return self::singleton()->invoke(2, $results, $items, | |
1935 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
1936 | 'civicrm_batchItems' | |
1937 | ); | |
1938 | } | |
1939 | ||
72e86d7d CW |
1940 | /** |
1941 | * This hook is called when core resources are being loaded | |
1942 | * | |
1943 | * @see CRM_Core_Resources::coreResourceList | |
1944 | * | |
1945 | * @param array $list | |
e3c1e85b | 1946 | * @param string $region |
72e86d7d | 1947 | */ |
e3c1e85b | 1948 | public static function coreResourceList(&$list, $region) { |
72e86d7d CW |
1949 | // First allow the cms integration to add to the list |
1950 | CRM_Core_Config::singleton()->userSystem->appendCoreResources($list); | |
1951 | ||
e3c1e85b CW |
1952 | self::singleton()->invoke(2, $list, $region, |
1953 | self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, | |
72e86d7d CW |
1954 | 'civicrm_coreResourceList' |
1955 | ); | |
1956 | } | |
1957 | ||
6a488035 | 1958 | } |