blob: b331fdb8e698eef3e7ac516b8230309587ab4655 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``sandbox``
2===========
3
4The ``sandbox`` tag can be used to enable the sandboxing mode for an included
5template, when sandboxing is not enabled globally for the Twig environment:
6
7.. code-block:: twig
8
9 {% sandbox %}
10 {% include 'user.html' %}
11 {% endsandbox %}
12
13.. warning::
14
15 The ``sandbox`` tag is only available when the sandbox extension is
16 enabled (see the :doc:`Twig for Developers<../api>` chapter).
17
18.. note::
19
20 The ``sandbox`` tag can only be used to sandbox an include tag and it
21 cannot be used to sandbox a section of a template. The following example
22 won't work:
23
24 .. code-block:: twig
25
26 {% sandbox %}
27 {% for i in 1..2 %}
28 {{ i }}
29 {% endfor %}
30 {% endsandbox %}