Skip to content

Commit

Permalink
feat(ui_patterns_library): Support multitheme sites
Browse files Browse the repository at this point in the history
  • Loading branch information
WidgetsBurritos committed Sep 25, 2020
1 parent cd03369 commit 37e584f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
18 changes: 3 additions & 15 deletions modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Drupal\Tests\ui_patterns_library\FunctionalJavascript;

/**
* Test patterns overview page displays for non-default themes.
*
* @group ui_patterns_library
*/
class UiPatternsLibraryAlternativeThemeTest extends UiPatternsLibraryOverviewTest {

/**
* Default theme.
*
* @var string
*/
protected $defaultTheme = 'stark';

/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();

$active_theme = $this->container->get('theme.initialization')->initTheme('ui_patterns_library_theme_test');
$this->container->get('theme.manager')->setActiveTheme($active_theme);
}

}

0 comments on commit 37e584f

Please sign in to comment.