Skip to content

Commit 52f70cb

Browse files
authored
Merge pull request #1 from evanmwillhite/develop
Questions for usage with Emulsify
2 parents c0fa939 + 000024c commit 52f70cb

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/TwigExtension/ExtensionLoader.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)