Skip to content

Commit

Permalink
Ajoute l'extension "Debug" à Twig
Browse files Browse the repository at this point in the history
  • Loading branch information
Donov4n committed May 2, 2021
1 parent 947b198 commit 70c4d20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/src/App/Services/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Slim\Views\Twig;
use Twig\TwigFunction;
use Robert2\API\Config\Config;
use Twig\Extension\DebugExtension;
use Twig\Extra\Intl\IntlExtension;
use Twig\Extra\String\StringExtension;
use Psr\Http\Message\ResponseInterface as Response;
Expand All @@ -25,7 +26,10 @@ public function __construct(I18n $i18n)
if (!isTestMode() && Config::getEnv() === 'production') {
$cachePath = VAR_FOLDER . DS . 'cache' . DS . 'views';
}
$this->view = Twig::create(VIEWS_FOLDER, ['cache' => $cachePath]);
$this->view = Twig::create(VIEWS_FOLDER, [
'debug' => isTestMode() || Config::getEnv() !== 'production',
'cache' => $cachePath,
]);

//
// - Global variables
Expand All @@ -39,6 +43,7 @@ public function __construct(I18n $i18n)

$this->view->addExtension(new IntlExtension());
$this->view->addExtension(new StringExtension());
$this->view->addExtension(new DebugExtension());

//
// - Functions
Expand Down

0 comments on commit 70c4d20

Please sign in to comment.