diff --git a/composer.json b/composer.json index b90b61020..aca070708 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "nette/di": "<3.0.7", "nette/forms": "<3.0", "nette/schema": "<1.2", - "latte/latte": "<2.7.1 || >=3.1 || =3.0.0", + "latte/latte": "<2.7.1 || >=3.0.0 <3.0.5 || >=3.1", "tracy/tracy": "<2.5" }, "autoload": { diff --git a/src/Bridges/ApplicationDI/LatteExtension.php b/src/Bridges/ApplicationDI/LatteExtension.php index b9995668b..02b53c06e 100644 --- a/src/Bridges/ApplicationDI/LatteExtension.php +++ b/src/Bridges/ApplicationDI/LatteExtension.php @@ -116,10 +116,12 @@ public static function initLattePanel( $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() : '' - )); + $name = $all && $control ? (new \ReflectionObject($control))->getShortName() : ''; + if (version_compare(Latte\Engine::VERSION, '3', '<')) { + $bar->addPanel(new Latte\Bridges\Tracy\LattePanel($template->getLatte(), $name)); + } else { + $template->getLatte()->addExtension(new Latte\Bridges\Tracy\TracyExtension($name)); + } } }; }