From 37e584f0a858c134251ff8fd91b0b9d86fb1f286 Mon Sep 17 00:00:00 2001 From: David Stinemetze Date: Thu, 24 Sep 2020 23:42:58 -0500 Subject: [PATCH 1/2] 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); + } + +} From 65518419ccd6a315ccb15e496328f3113931b418 Mon Sep 17 00:00:00 2001 From: David Stinemetze Date: Fri, 25 Sep 2020 11:35:39 -0500 Subject: [PATCH 2/2] chore(LibraryDeriver): Swap order of themes/modules directories --- .../src/Plugin/Deriver/LibraryDeriver.php | 2 +- .../UiPatternsLibraryAlternativeThemeTest.php | 29 ------------------- 2 files changed, 1 insertion(+), 30 deletions(-) delete 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 83be84f2..5600a051 100644 --- a/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php +++ b/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php @@ -161,7 +161,7 @@ public function getPatterns() { * An array containing directory paths keyed by their extension name. */ protected function getDirectories() { - return $this->moduleHandler->getModuleDirectories() + $this->themeHandler->getThemeDirectories(); + return $this->themeHandler->getThemeDirectories() + $this->moduleHandler->getModuleDirectories(); } /** diff --git a/modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php b/modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php deleted file mode 100644 index b087f5bf..00000000 --- a/modules/ui_patterns_library/tests/src/FunctionalJavascript/UiPatternsLibraryAlternativeThemeTest.php +++ /dev/null @@ -1,29 +0,0 @@ -container->get('theme.initialization')->initTheme('ui_patterns_library_theme_test'); - $this->container->get('theme.manager')->setActiveTheme($active_theme); - } - -}