From a323ce8a98e43f501ac5b3d114ab37b34046ce68 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 30 Nov 2021 14:26:11 -0800 Subject: [PATCH] mixin/ang-php - Import --- mixin/ang-php@1/mixin.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 mixin/ang-php@1/mixin.php 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; + } + }); + +}; -- 2.25.1