Skip to content

Commit

Permalink
LatteExtension: inject interface to be more compatible (#288)
Browse files Browse the repository at this point in the history
Co-authored-by: Miloslav Hůla <miloslav.hula@fsv.cvut.cz>
  • Loading branch information
milo and Miloslav Hůla authored May 26, 2021
1 parent a7ff0c1 commit 11bc5ae
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Bridges/ApplicationDI/LatteExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() : '',
));
}
};
}
}


Expand Down

0 comments on commit 11bc5ae

Please sign in to comment.