Skip to content

Commit

Permalink
Fix doc CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 28, 2022
1 parent fab3e0f commit 9170edf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions doc/functions/template_from_string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@ any related error message:
.. note::

The ``template_from_string`` function is not available by default.

In Symfony projects, you need to load it in your ``services.yaml``::

On Symfony projects, you need to load it in your ``services.yaml`` file:

.. code-block:: yaml
services:
Twig\Extension\StringLoaderExtension:
or ``services.php``::
or ``services.php`` file::

$services->set(\Twig\Extension\StringLoaderExtension::class);

Otherwise, add the extension explicitly on the Twig environment::

use Twig\Extension\StringLoaderExtension;

$twig = new \Twig\Environment(...);
$twig->addExtension(new \Twig\Extension\StringLoaderExtension());
$twig->addExtension(new StringLoaderExtension());

.. note::

Expand Down

0 comments on commit 9170edf

Please sign in to comment.