Skip to content

Commit

Permalink
Presenter::formatLayoutTemplateFiles() when local 'template' folder e…
Browse files Browse the repository at this point in the history
…xists, bypasses searching in parent folders (BC break)
  • Loading branch information
dg committed Feb 1, 2015
1 parent d08a5ed commit 3e21280
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Application/UI/Presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,14 @@ public function formatLayoutTemplateFiles()
$layout = $this->layout ? $this->layout : 'layout';
$rc = $this->getReflection();
$dir = dirname($rc->getFileName());
$dir = is_dir("$dir/templates") ? $dir : dirname($dir);
$dir = ($newWay = is_dir("$dir/templates")) ? $dir : dirname($dir);
$list = array(
"$dir/templates/$presenter/@$layout.latte",
"$dir/templates/$presenter.@$layout.latte",
);
do {
$list[] = "$dir/templates/@$layout.latte";
$dir = dirname($dir);
$dir = $newWay ? FALSE : dirname($dir);
} while ($dir && ($name = substr($name, 0, strrpos($name, ':'))));

while (($rc = $rc->getParentClass()) && $rc->getName() !== __CLASS__) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ test(function() { // with module & subdir templates
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One/@layout.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/One.@layout.latte',
__DIR__ . DIRECTORY_SEPARATOR . 'one/templates/@layout.latte',
__DIR__ . '/templates/@layout.latte',
dirname(__DIR__) . '/templates/@layout.latte',
), $presenter->formatLayoutTemplateFiles() );
});

Expand Down

0 comments on commit 3e21280

Please sign in to comment.