File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/PatternLab/PatternEngine/Twig/Loaders Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,22 @@ public function __construct($options = array()) {
4848 if (is_dir ($ layoutsPath )) {
4949 $ filesystemLoaderPaths [] = $ layoutsPath ;
5050 }
51-
51+
52+ // add source/_patterns subdirectories for Drupal theme template compatibility
53+ $ patternSourceDir = Config::getOption ("sourceDir " ).DIRECTORY_SEPARATOR ."_patterns " ;
54+ $ patternObjects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ patternSourceDir ), \RecursiveIteratorIterator::SELF_FIRST );
55+ $ patternObjects ->setFlags (\FilesystemIterator::SKIP_DOTS );
56+
57+ // sort the returned objects
58+ $ patternObjects = iterator_to_array ($ patternObjects );
59+ ksort ($ patternObjects );
60+
61+ foreach ($ patternObjects as $ name => $ object ) {
62+ if ($ object ->isDir ()) {
63+ $ filesystemLoaderPaths [] = $ object ->getPathname ();
64+ }
65+ }
66+
5267 // add the paths to the filesystem loader if the paths existed
5368 if (count ($ filesystemLoaderPaths ) > 0 ) {
5469 $ loaders [] = new \Twig_Loader_Filesystem ($ filesystemLoaderPaths );
You can’t perform that action at this time.
0 commit comments