File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -46,18 +46,19 @@ 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 . '/ ' . ' source/ _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
- if ($ file [0 ] != '. ' && $ file [0 ] != '_ ' ) {
59
- // print_r($file);
60
- 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
+ }
61
+ }
61
62
}
62
63
}
63
64
}
You can’t perform that action at this time.
0 commit comments