@@ -46,19 +46,18 @@ static public function get($type) {
46
46
static protected function loadAll ($ type ) {
47
47
$ theme = \Drupal::config ('system.theme ' )->get ('default ' );
48
48
$ themeLocation = drupal_get_path ('theme ' , $ theme );
49
- $ fullPath = DRUPAL_ROOT . '/ ' . $ themeLocation . '/ ' . ' pattern-lab/source/_twig-components / ' ;
49
+ $ themePath = DRUPAL_ROOT . '/ ' . $ themeLocation . '/ ' ;
50
50
51
- $ fullPathAlt = DRUPAL_ROOT . ' / ' . $ themeLocation . '/ ' . ' components/ _twig-components/ ' ;
51
+ $ extensionPaths = glob ( $ themePath . '*/ _twig-components/ ' ) ;
52
52
53
- if (file_exists ($ fullPathAlt )){
54
- $ fullPath = $ fullPathAlt ;
55
- }
56
-
57
- foreach (scandir ($ fullPath . $ type ) as $ file ) {
58
- $ fileInfo = pathinfo ($ file );
59
- if ($ fileInfo ['extension ' ] === 'php ' ) {
60
- if ($ file [0 ] != '. ' && $ file [0 ] != '_ ' && substr ($ file , 0 , 3 ) != 'pl_ ' ) {
61
- static ::load ($ type , $ fullPath . $ type . '/ ' . $ file );
53
+ foreach ($ extensionPaths as $ extensionPath ) {
54
+ $ fullPath = $ extensionPath ;
55
+ foreach (scandir ($ fullPath . $ type ) as $ file ) {
56
+ $ fileInfo = pathinfo ($ file );
57
+ if ($ fileInfo ['extension ' ] === 'php ' ) {
58
+ if ($ file [0 ] != '. ' && $ file [0 ] != '_ ' && substr ($ file , 0 , 3 ) != 'pl_ ' ) {
59
+ static ::load ($ type , $ fullPath . $ type . '/ ' . $ file );
60
+ }
62
61
}
63
62
}
64
63
}
0 commit comments