Skip to content

Commit 235f0b8

Browse files
committed
UIMacros: do not use layout for templates without blocks
1 parent 6164255 commit 235f0b8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Bridges/ApplicationLatte/UIMacros.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function install(Latte\Compiler $compiler)
4848
public function initialize()
4949
{
5050
$this->getCompiler()->addMethod('getParentName', '
51-
return !$this->getReferringTemplate() && $this->params["_control"] instanceof Nette\Application\UI\Presenter
51+
return $this->blocks && !$this->getReferringTemplate() && $this->params["_control"] instanceof Nette\Application\UI\Presenter
5252
? $this->params["_control"]->findLayoutTemplateFile() : NULL;
5353
');
5454
}

tests/Bridges.Latte/Template.getParentName().phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ $template = $latte->createTemplate(
2424
'',
2525
['_control' => new MockPresenter]
2626
);
27-
Assert::same('layout.latte', $template->getParentName());
27+
Assert::null($template->getParentName());
2828

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

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

0 commit comments

Comments
 (0)