File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,18 @@ any related error message:
2121
2222 .. note ::
2323
24- The ``template_from_string `` function is not available by default. You
25- must add the ``\Twig\Extension\StringLoaderExtension `` extension explicitly when
26- creating your Twig environment::
24+ The ``template_from_string `` function is not available by default.
25+
26+ In Symfony projects, you need to load it in your ``services.yaml ``::
27+
28+ services:
29+ Twig\Extension\StringLoaderExtension:
30+
31+ or ``services.php ``::
32+
33+ $services->set(\Twig\Extension\StringLoaderExtension::class);
34+
35+ Otherwise, add the extension explicitly on the Twig environment::
2736
2837 $twig = new \Twig\Environment(...);
2938 $twig->addExtension(new \Twig\Extension\StringLoaderExtension());
You can’t perform that action at this time.
0 commit comments