deprecated

Twig generates a deprecation notice (via a call to the trigger_error() PHP function) where the deprecated tag is used in a template:

Twig は、非推奨のタグがテンプレートで使用されている場合に (trigger_error()PHP 関数の呼び出しを介して) 非推奨の通知を生成します。
1
2
3
{# base.twig #}
{% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %}
{% extends 'layout.twig' %}

You can also deprecate a macro in the following way:

次の方法でマクロを非推奨にすることもできます。
1
2
3
4
5
{% macro welcome(name) %}
    {% deprecated 'The "welcome" macro is deprecated, use "hello" instead.' %}

    ...
{% endmacro %}

Note that by default, the deprecation notices are silenced and never displayed nor logged. See Recipes 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.

非推奨タグを使用してブロックを非推奨にしないでください。非推奨は常に正しくトリガーされるとは限りません。