Skip to content

Commit 9276c00

Browse files
committed
Presenter::formatLayoutTemplateFiles() when local 'template' folder exists, bypasses searching in parent folders (BC break)
1 parent 32a1596 commit 9276c00

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Application/UI/Presenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,14 @@ public function formatLayoutTemplateFiles()
504504
$layout = $this->layout ? $this->layout : 'layout';
505505
$rc = $this->getReflection();
506506
$dir = dirname($rc->getFileName());
507-
$dir = is_dir("$dir/templates") ? $dir : dirname($dir);
507+
$dir = ($newWay = is_dir("$dir/templates")) ? $dir : dirname($dir);
508508
$list = array(
509509
"$dir/templates/$presenter/@$layout.latte",
510510
"$dir/templates/$presenter.@$layout.latte",
511511
);
512512
do {
513513
$list[] = "$dir/templates/@$layout.latte";
514-
$dir = dirname($dir);
514+
$dir = $newWay ? FALSE : dirname($dir);
515515
} while ($dir && ($name = substr($name, 0, strrpos($name, ':'))));
516516

517517
while (($rc = $rc->getParentClass()) && $rc->getName() !== __CLASS__) {

tests/Application.templates/Presenter.formatLayoutTemplateFiles.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ test(function() { // with module & subdir templates
4747
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@layout.latte',
4848
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/[email protected]',
4949
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/@layout.latte',
50-
__DIR__ . '/templates/@layout.latte',
51-
dirname(__DIR__) . '/templates/@layout.latte',
5250
), $presenter->formatLayoutTemplateFiles() );
5351
});
5452

0 commit comments

Comments
 (0)