1``deprecated``
2==============
3
4.. versionadded:: 1.36 and 2.6
5    The ``deprecated`` tag was added in Twig 1.36 and 2.6.
6
7Twig generates a deprecation notice (via a call to the ``trigger_error()``
8PHP function) where the ``deprecated`` tag is used in a template:
9
10.. code-block:: jinja
11
12    {# base.twig #}
13    {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
14    {% extends 'layout.twig' %}
15
16Also you can deprecate a block in the following way:
17
18.. code-block:: jinja
19
20    {% block hey %}
21        {% deprecated 'The "hey" block is deprecated, use "greet" instead.' %}
22        {{ block('greet') }}
23    {% endblock %}
24
25    {% block greet %}
26        Hey you!
27    {% endblock %}
28
29Note that by default, the deprecation notices are silenced and never displayed nor logged.
30See :ref:`deprecation-notices` to learn how to handle them.
31