diff --git a/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php b/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php index 5601003b..f0ba20d5 100644 --- a/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php +++ b/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php @@ -154,27 +154,14 @@ public function getPatterns() { /** * Create a list of all directories to scan. * - * This includes all module directories and directories of the default theme - * and all of its possible base themes. + * This includes all module and theme directories. * * @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/fixtures/overview-page-patterns.yml b/modules/ui_patterns_library/tests/fixtures/overview-page-patterns.yml index a08b7cf4..e3043702 100644 --- a/modules/ui_patterns_library/tests/fixtures/overview-page-patterns.yml +++ b/modules/ui_patterns_library/tests/fixtures/overview-page-patterns.yml @@ -1,48 +1,3 @@ -- name: 'simple' - label: 'Simple' - description: 'A simple pattern' - has_variants: false - preview: '
Simple pattern field
' - fields: - - name: 'field' - type: 'string' - label: 'Field' - description: 'Field description' - -- name: 'with_variants' - label: 'With variants' - description: 'Pattern with variants' - has_variants: true - preview: ~ - fields: - - name: 'field' - type: 'string' - label: 'Field' - description: 'Field description' - variants: - - meta: - name: 'one' - label: 'One' - description: 'First variant' - preview: '
With variants pattern field
' - - meta: - name: 'two' - label: 'Two' - description: 'Second variant' - preview: '
With variants pattern field
' - -- name: 'with_custom_theme_hook' - theme hook: 'custom_theme_hook' - label: 'With custom theme hook' - description: 'Pattern with custom theme hook.' - has_variants: false - preview: 'With custom theme hook: Pattern field value' - fields: - - name: 'field' - type: 'string' - label: 'Field' - description: 'Field description' - - name: 'button' label: 'Button' description: 'A simple button.' @@ -97,3 +52,48 @@ type: 'string' label: 'Field' description: 'Field description' + +- name: 'simple' + label: 'Simple' + description: 'A simple pattern' + has_variants: false + preview: '
Simple pattern field
' + fields: + - name: 'field' + type: 'string' + label: 'Field' + description: 'Field description' + +- name: 'with_variants' + label: 'With variants' + description: 'Pattern with variants' + has_variants: true + preview: ~ + fields: + - name: 'field' + type: 'string' + label: 'Field' + description: 'Field description' + variants: + - meta: + name: 'one' + label: 'One' + description: 'First variant' + preview: '
With variants pattern field
' + - meta: + name: 'two' + label: 'Two' + description: 'Second variant' + preview: '
With variants pattern field
' + +- name: 'with_custom_theme_hook' + theme hook: 'custom_theme_hook' + label: 'With custom theme hook' + description: 'Pattern with custom theme hook.' + has_variants: false + preview: 'With custom theme hook: Pattern field value' + fields: + - name: 'field' + type: 'string' + label: 'Field' + description: 'Field description'