/
mixin.php
32 lines (28 loc) · 881 Bytes
/
mixin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Auto-register "xml/Menu/*.xml" files.
*
* @mixinName menu-xml
* @mixinVersion 1.0.0
* @since 5.45
*
* @param CRM_Extension_MixInfo $mixInfo
* On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
* @param \CRM_Extension_BootCache $bootCache
* On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
*/
return function ($mixInfo, $bootCache) {
/**
* @param \Civi\Core\Event\GenericHookEvent $e
* @see CRM_Utils_Hook::xmlMenu()
*/
Civi::dispatcher()->addListener('hook_civicrm_xmlMenu', function ($e) use ($mixInfo) {
if (!$mixInfo->isActive()) {
return;
}
$files = (array) glob($mixInfo->getPath('xml/Menu/*.xml'));
foreach ($files as $file) {
$e->files[] = $file;
}
});
};