From c2a3d197089a0c25bb494db598b6bb5f35dec023 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 30 Nov 2021 14:26:50 -0800 Subject: [PATCH] mixin/theme-php - Import --- mixin/theme-php@1/mixin.php | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 mixin/theme-php@1/mixin.php diff --git a/mixin/theme-php@1/mixin.php b/mixin/theme-php@1/mixin.php new file mode 100644 index 0000000000..c49b60538f --- /dev/null +++ b/mixin/theme-php@1/mixin.php @@ -0,0 +1,38 @@ +addListener('hook_civicrm_themes', function ($e) use ($mixInfo) { + // When deactivating on a polyfill/pre-mixin system, listeners may not cleanup automatically. + if (!$mixInfo->isActive()) { + return; + } + $files = (array) glob($mixInfo->getPath('*.theme.php')); + foreach ($files as $file) { + $themeMeta = include $file; + if (empty($themeMeta['name'])) { + $themeMeta['name'] = preg_replace(':\.theme\.php$:', '', basename($file)); + } + if (empty($themeMeta['ext'])) { + $themeMeta['ext'] = $mixInfo->longName; + } + $e->themes[$themeMeta['name']] = $themeMeta; + } + }); + +}; -- 2.25.1