mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 18:36:53 +00:00
Fix docs about the deprecated tag
This commit is contained in:
+10
-8
@@ -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.' %}
|
{% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
|
||||||
{% extends 'layout.twig' %}
|
{% 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
|
.. code-block:: twig
|
||||||
|
|
||||||
{% block hey %}
|
{% macro welcome(name) %}
|
||||||
{% deprecated 'The "hey" block is deprecated, use "greet" instead.' %}
|
{% deprecated 'The "welcome" macro is deprecated, use "hello" instead.' %}
|
||||||
{{ block('greet') }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block greet %}
|
...
|
||||||
Hey you!
|
{% endmacro %}
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
Note that by default, the deprecation notices are silenced and never displayed nor logged.
|
Note that by default, the deprecation notices are silenced and never displayed nor logged.
|
||||||
See :ref:`deprecation-notices` to learn how to handle them.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user