Skip to content

Commit

Permalink
Latte: uses TracyExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 17, 2023
1 parent 51a94be commit 9c31b24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 6 additions & 4 deletions src/Bridges/ApplicationDI/LatteExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,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));
}
}
};
}
Expand Down

0 comments on commit 9c31b24

Please sign in to comment.