From 37e584f0a858c134251ff8fd91b0b9d86fb1f286 Mon Sep 17 00:00:00 2001 From: David Stinemetze Date: Thu, 24 Sep 2020 23:42:58 -0500 Subject: [PATCH] feat(ui_patterns_library): Support multitheme sites --- .../src/Plugin/Deriver/LibraryDeriver.php | 18 ++---------- .../UiPatternsLibraryAlternativeThemeTest.php | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php diff --git a/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php b/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php index 5601003b..83be84f2 100644 --- a/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php +++ b/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php @@ -160,21 +160,9 @@ public function getPatterns() { * @return array * An array containing directory paths keyed by their extension name. */ - protected function getDirectories() { - $default_theme = $this->themeHandler->getDefault(); - $base_themes = $this->themeHandler->getBaseThemes($this->themeHandler->listInfo(), $default_theme); - $theme_directories = $this->themeHandler->getThemeDirectories(); - - $directories = []; - if (isset($theme_directories[$default_theme])) { - $directories[$default_theme] = $theme_directories[$default_theme]; - foreach ($base_themes as $name => $theme) { - $directories[$name] = $theme_directories[$name]; - } - } - - return $directories + $this->moduleHandler->getModuleDirectories(); - } + protected function getDirectories() { + return $this->moduleHandler->getModuleDirectories() + $this->themeHandler->getThemeDirectories(); + } /** * Get extension name that hosts the given YAML definition file. diff --git a/modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php b/modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php new file mode 100644 index 00000000..b087f5bf --- /dev/null +++ b/modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php @@ -0,0 +1,29 @@ +container->get('theme.initialization')->initTheme('ui_patterns_library_theme_test'); + $this->container->get('theme.manager')->setActiveTheme($active_theme); + } + +}