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) {
4646 static protected function loadAll ($ type ) {
4747 $ theme = \Drupal::config ('system.theme ' )->get ('default ' );
4848 $ themeLocation = drupal_get_path ('theme ' , $ theme );
49- $ fullPath = DRUPAL_ROOT . '/ ' . $ themeLocation . '/ ' . ' pattern-lab/source/_twig-components / ' ;
49+ $ themePath = DRUPAL_ROOT . '/ ' . $ themeLocation . '/ ' ;
5050
51- $ fullPathAlt = DRUPAL_ROOT . ' / ' . $ themeLocation . '/ ' . ' source/ _twig-components/ ' ;
51+ $ extensionPaths = glob ( $ themePath . '*/ _twig-components/ ' ) ;
5252
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+ }
6162 }
6263 }
6364 }
You can’t perform that action at this time.
0 commit comments