diff --git a/src/Bridges/ApplicationDI/LatteExtension.php b/src/Bridges/ApplicationDI/LatteExtension.php index 91868d14d..2d375a3d8 100644 --- a/src/Bridges/ApplicationDI/LatteExtension.php +++ b/src/Bridges/ApplicationDI/LatteExtension.php @@ -94,17 +94,19 @@ public function beforeCompile() } - public static function initLattePanel(ApplicationLatte\TemplateFactory $factory, Tracy\Bar $bar, bool $all = false) + public static function initLattePanel(Nette\Application\UI\TemplateFactory $factory, Tracy\Bar $bar, bool $all = false) { - $factory->onCreate[] = function (ApplicationLatte\Template $template) use ($bar, $all) { - $control = $template->getLatte()->getProviders()['uiControl'] ?? null; - if ($all || $control instanceof Nette\Application\UI\Presenter) { - $bar->addPanel(new Latte\Bridges\Tracy\LattePanel( - $template->getLatte(), - $all && $control ? (new \ReflectionObject($control))->getShortName() : '', - )); - } - }; + if ($factory instanceof ApplicationLatte\TemplateFactory) { + $factory->onCreate[] = function (ApplicationLatte\Template $template) use ($bar, $all) { + $control = $template->getLatte()->getProviders()['uiControl'] ?? null; + if ($all || $control instanceof Nette\Application\UI\Presenter) { + $bar->addPanel(new Latte\Bridges\Tracy\LattePanel( + $template->getLatte(), + $all && $control ? (new \ReflectionObject($control))->getShortName() : '', + )); + } + }; + } }