From: Tim Otten Date: Tue, 30 Nov 2021 22:26:11 +0000 (-0800) Subject: mixin/ang-php - Import X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a323ce8a98e43f501ac5b3d114ab37b34046ce68;p=civicrm-core.git mixin/ang-php - Import --- diff --git a/mixin/ang-php@1/mixin.php b/mixin/ang-php@1/mixin.php new file mode 100644 index 0000000000..6719db3571 --- /dev/null +++ b/mixin/ang-php@1/mixin.php @@ -0,0 +1,37 @@ +addListener('hook_civicrm_angularModules', function ($e) use ($mixInfo) { + // When deactivating on a polyfill/pre-mixin system, listeners may not cleanup automatically. + if (!$mixInfo->isActive() || !is_dir($mixInfo->getPath('ang'))) { + return; + } + + $files = (array) glob($mixInfo->getPath('ang/*.ang.php')); + foreach ($files as $file) { + $name = preg_replace(':\.ang\.php$:', '', basename($file)); + $module = include $file; + if (empty($module['ext'])) { + $module['ext'] = $mixInfo->longName; + } + $e->angularModules[$name] = $module; + } + }); + +};