Skip to content

Commit

Permalink
Activate Twig debug mode (dump() feature) in local dev env.
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalchevrel committed Nov 6, 2023
1 parent 9b1d2d7 commit 9c6ee63
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/classes/ReleaseInsights/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,18 @@ public function render(): void
{
// Initialize our Templating system
$twig_loader = new FilesystemLoader(INSTALL_ROOT . 'app/views/templates');
$twig = new Environment($twig_loader);
$twig->addExtension(new IntlExtension());

// @codeCoverageIgnoreStart
// Allow Twig debug mode in local dev mode
if (LOCALHOST && !defined('TESTING_CONTEXT')) {
$twig = new Environment($twig_loader, ['debug' => true,]);
$twig->addExtension(new \Twig\Extension\DebugExtension());
} else {
$twig = new Environment($twig_loader);
}
// @codeCoverageIgnoreEnd

$twig->addExtension(new IntlExtension());
echo $twig->render($this->template, $this->data);
}
}

0 comments on commit 9c6ee63

Please sign in to comment.