diff --git a/src/Application/UI/Control.php b/src/Application/UI/Control.php index a2b24afeb..936d19d04 100644 --- a/src/Application/UI/Control.php +++ b/src/Application/UI/Control.php @@ -133,7 +133,7 @@ public function redrawControl(?string $snippet = null, bool $redraw = true): voi $this->invalidSnippets = []; } else { - $this->invalidSnippets[$snippet] = false; + unset($this->invalidSnippets[$snippet]); } } diff --git a/src/Bridges/ApplicationLatte/Nodes/ControlNode.php b/src/Bridges/ApplicationLatte/Nodes/ControlNode.php index 2a28c4640..6b0de3f73 100644 --- a/src/Bridges/ApplicationLatte/Nodes/ControlNode.php +++ b/src/Bridges/ApplicationLatte/Nodes/ControlNode.php @@ -94,11 +94,14 @@ public function print(PrintContext $context): string $this->name, ); + $fetchCode .= $tag->closestTag(['snippetArea']) && !$tag->closestTag(['snippet']) + ? 'if ($ʟ_tmp instanceof Nette\Application\UI\Renderable) $ʟ_tmp->snippetMode = $this->global->uiControl->snippetMode;' + : 'if ($ʟ_tmp instanceof Nette\Application\UI\Renderable) $ʟ_tmp->redrawControl(null, $ʟ_tmp->snippetMode = false);'; + if ($this->escape) { return $context->format( <<<'XX' %raw - if ($ʟ_tmp instanceof Nette\Application\UI\Renderable) $ʟ_tmp->redrawControl(null, false); ob_start(fn() => ''); $ʟ_tmp->%raw(%args) %line; $ʟ_fi = new LR\FilterInfo(%dump); echo %modifyContent(ob_get_clean()); @@ -117,7 +120,6 @@ public function print(PrintContext $context): string return $context->format( <<<'XX' %raw - if ($ʟ_tmp instanceof Nette\Application\UI\Renderable) $ʟ_tmp->redrawControl(null, false); $ʟ_tmp->%raw(%args) %line; diff --git a/src/Bridges/ApplicationLatte/SnippetRuntime.php b/src/Bridges/ApplicationLatte/SnippetRuntime.php index cfd2d9af1..05d8a690b 100644 --- a/src/Bridges/ApplicationLatte/SnippetRuntime.php +++ b/src/Bridges/ApplicationLatte/SnippetRuntime.php @@ -107,7 +107,7 @@ public function renderSnippets(array $blocks, array $params): bool } $this->renderingSnippets = true; - $this->control->snippetMode = false; + //$this->control->snippetMode = false; foreach ($blocks as $name => $block) { if (!$this->control->isControlInvalid($name)) { continue; @@ -117,7 +117,8 @@ public function renderSnippets(array $blocks, array $params): bool $function($params); } - $this->control->snippetMode = true; + $this->control->redrawControl(null, false); + //$this->control->snippetMode = true; $this->renderChildren(); return true; }