Skip to content

Commit 005fe1e

Browse files
authored
Merge pull request #7 from jeffreymb/fix_js
Fix Rollbar JS integration that wasn't functional
2 parents 5c13cd1 + 86666db commit 005fe1e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Twig/RollbarExtension.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public function getFunctions()
4848
}
4949

5050
return [
51-
new \Twig_SimpleFunction('rollbarJs', [$this, 'rollbarJs']),
51+
new \Twig_SimpleFunction('rollbarJs', [$this, 'rollbarJs'], [
52+
'is_safe' => ['html'],
53+
]),
5254
];
5355
}
5456

@@ -59,7 +61,7 @@ public function rollbarJs()
5961
{
6062
$helper = new RollbarJsHelper($this->config['rollbar_js']);
6163

62-
$script = "<script>var _rollbarConfig = {{config}};\n{{rollbar-snippet}}</script>";
64+
$script = "<script>{{config}};\n{{rollbar-snippet}}</script>";
6365
$script = strtr($script, [
6466
'{{config}}' => $helper->configJsTag(),
6567
'{{rollbar-snippet}}' => $helper->jsSnippet(),

0 commit comments

Comments
 (0)