Skip to content

Commit

Permalink
UIMacros: do not use layout for templates without blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 5, 2016
1 parent 55210af commit 91fa976
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Bridges/ApplicationLatte/UIMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function install(Latte\Compiler $compiler)
public function initialize()
{
$this->getCompiler()->addMethod('getParentName', '
return !$this->getReferringTemplate() && $this->params["_control"] instanceof Nette\Application\UI\Presenter
return $this->blocks && !$this->getReferringTemplate() && $this->params["_control"] instanceof Nette\Application\UI\Presenter
? $this->params["_control"]->findLayoutTemplateFile() : NULL;
');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Bridges.Latte/Template.getParentName().phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ $template = $latte->createTemplate(
'',
['_control' => new MockPresenter]
);
Assert::same('layout.latte', $template->getParentName());
Assert::null($template->getParentName());

$template = $latte->createTemplate(
'{block}...{/block}',
['_control' => new MockPresenter]
);
Assert::same('layout.latte', $template->getParentName());
Assert::null($template->getParentName());

$template = $latte->createTemplate(
'{block name}...{/block}',
Expand Down

0 comments on commit 91fa976

Please sign in to comment.