[Ref] Remove unused _colours property
[civicrm-core.git] / mixin / ang-php@1 / mixin.php
1 <?php
2
3 /**
4 * Auto-register "ang/*.ang.php" files.
5 *
6 * @mixinName ang-php
7 * @mixinVersion 1.0.0
8 *
9 * @param CRM_Extension_MixInfo $mixInfo
10 * On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
11 * @param \CRM_Extension_BootCache $bootCache
12 * On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like.
13 */
14 return function ($mixInfo, $bootCache) {
15
16 /**
17 * @param \Civi\Core\Event\GenericHookEvent $e
18 * @see CRM_Utils_Hook::angularModules()
19 */
20 Civi::dispatcher()->addListener('hook_civicrm_angularModules', function ($e) use ($mixInfo) {
21 // When deactivating on a polyfill/pre-mixin system, listeners may not cleanup automatically.
22 if (!$mixInfo->isActive() || !is_dir($mixInfo->getPath('ang'))) {
23 return;
24 }
25
26 $files = (array) glob($mixInfo->getPath('ang/*.ang.php'));
27 foreach ($files as $file) {
28 $name = preg_replace(':\.ang\.php$:', '', basename($file));
29 $module = include $file;
30 if (empty($module['ext'])) {
31 $module['ext'] = $mixInfo->longName;
32 }
33 $e->angularModules[$name] = $module;
34 }
35 });
36
37 };