Skip to content

Commit 79af108

Browse files
committed
Latte: uses TracyExtension
1 parent 8356185 commit 79af108

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"nette/di": "<3.0.7",
4343
"nette/forms": "<3.0",
4444
"nette/schema": "<1.2",
45-
"latte/latte": "<2.7.1 || >=3.1 || =3.0.0",
45+
"latte/latte": "<2.7.1 || >=3.0.0 <3.0.5 || >=3.1",
4646
"tracy/tracy": "<2.5"
4747
},
4848
"autoload": {

src/Bridges/ApplicationDI/LatteExtension.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ public static function initLattePanel(
116116
$factory->onCreate[] = function (ApplicationLatte\Template $template) use ($bar, $all) {
117117
$control = $template->getLatte()->getProviders()['uiControl'] ?? null;
118118
if ($all || $control instanceof Nette\Application\UI\Presenter) {
119-
$bar->addPanel(new Latte\Bridges\Tracy\LattePanel(
120-
$template->getLatte(),
121-
$all && $control ? (new \ReflectionObject($control))->getShortName() : ''
122-
));
119+
$name = $all && $control ? (new \ReflectionObject($control))->getShortName() : '';
120+
if (version_compare(Latte\Engine::VERSION, '3', '<')) {
121+
$bar->addPanel(new Latte\Bridges\Tracy\LattePanel($template->getLatte(), $name));
122+
} else {
123+
$template->getLatte()->addExtension(new Latte\Bridges\Tracy\TracyExtension($name));
124+
}
123125
}
124126
};
125127
}

0 commit comments

Comments
 (0)