bundleFinder->getExistingBundlesPath('Resources/views/components/modal_lazy') as $bundle => $path) { $prefix = str_replace('Bundle', '', $bundle); foreach (glob("{$path}/*.html.twig") as $modal) { $filename = pathinfo($modal)['basename']; yield "@{$prefix}/components/modal_lazy/{$filename}"; } } // List all shop templates in modals if (is_dir(__DIR__.'/../../../../../shop/twig/modal_lazy')) { foreach (new \FilesystemIterator(__DIR__.'/../../../../../shop/twig/modal_lazy') as $file) { yield 'modal_lazy/'.$file->getFilename(); } } // List all templates in modals foreach (new \FilesystemIterator(__DIR__.'/../../../../web/common/twig/templates/modal_lazy') as $file) { yield 'modal_lazy/'.$file->getFilename(); } } }