Skip to content

Commit d764a25

Browse files
authored
Allow empty template override
1 parent 052bdd1 commit d764a25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Infinityloop/LazyComponent/LazyComponent.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
abstract class LazyComponent extends \Nette\Application\UI\Control
88
{
9+
protected const EMPTY_TEMPLATE = __DIR__ . '/emptyTemplate.latte';
10+
911
private bool $loaded = false;
1012

1113
public function handleLoadComponent() : void
@@ -23,6 +25,7 @@ public function render() : void
2325
{
2426
$this->template->setFile(__DIR__ . '/LazyComponent.latte');
2527
$this->template->loaded = $this->loaded;
28+
$this->template->emptyTemplate = static::EMPTY_TEMPLATE;
2629

2730
if ($this->loaded) {
2831
$this->beforeRender();
@@ -50,7 +53,7 @@ public function saveState(array &$params): void
5053
public function loadState(array $params): void
5154
{
5255
parent::loadState($params);
53-
$this->loaded = (bool) ($params['lazyComponent_loaded'] ?? $this-loaded);
56+
$this->loaded = (bool) ($params['lazyComponent_loaded'] ?? $this->loaded);
5457
}
5558

5659
protected function beforeRender() : void

0 commit comments

Comments
 (0)