Skip to content

Commit

Permalink
minor #3672 Fix docs about the deprecated tag (fabpot)
Browse files Browse the repository at this point in the history
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

Fix docs about the deprecated tag

Closes #3594

Commits
-------

17142af Fix docs about the deprecated tag
  • Loading branch information
fabpot committed Mar 26, 2022
2 parents 28bec2f + 17142af commit 1dd5c10
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions doc/tags/deprecated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ PHP function) where the ``deprecated`` tag is used in a template:
{% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
{% extends 'layout.twig' %}
Also you can deprecate a block in the following way:
You can also deprecate a macro in the following way:

.. code-block:: twig
{% block hey %}
{% deprecated 'The "hey" block is deprecated, use "greet" instead.' %}
{{ block('greet') }}
{% endblock %}
{% macro welcome(name) %}
{% deprecated 'The "welcome" macro is deprecated, use "hello" instead.' %}
{% block greet %}
Hey you!
{% endblock %}
...
{% endmacro %}
Note that by default, the deprecation notices are silenced and never displayed nor logged.
See :ref:`deprecation-notices` to learn how to handle them.

.. note::

Don't use the ``deprecated`` tag to deprecate a ``block`` as the
deprecation cannot always be triggered correctly.

0 comments on commit 1dd5c10

Please sign in to comment.