Skip to content

Commit

Permalink
support different bundle paths
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Oct 1, 2024
1 parent 30ca4bf commit c4dac36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Filesystem/TwigTemplateLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ protected function generateContaoTwigTemplatePaths(bool $extension = false): arr
foreach ($bundles as $key => $bundle) {
$path = $bundle->getPath();

foreach (['/templates', '/src/Resources/views',] as $subpath) {
foreach (['/templates', '/Resources/views',] as $subpath) {
if (!is_dir($dir = rtrim($path, '/').$subpath)) {
continue;
}
Expand Down
7 changes: 5 additions & 2 deletions tests/Filesystem/TwigTemplateLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,12 @@ private function prepareTemplateLoader(array $parameters): array
$kernel = $this->createMock(Kernel::class);
$bundles = [];
$bundleMetaData = [];
foreach (['a', 'b'] as $bundle) {
$kernelBundles = [
'a' => $projectDir . '/vendor/example/a',
'b' => $projectDir . '/vendor/example/b/src',
];
foreach ($kernelBundles as $bundle => $bundlePath) {
$currentBundle = $this->createMock(BundleInterface::class);
$bundlePath = $projectDir.'/vendor/example/'.$bundle;
$currentBundle->method('getPath')->willReturn($bundlePath);
$currentBundle->method('getName')->willReturn($bundle);
$kernelBundles[$bundle] = $currentBundle;
Expand Down

0 comments on commit c4dac36

Please sign in to comment.