Edit on GitHub
Jump to docs navigation

Twig Components / Methods / deprecated

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

{# base.twig #} 
{% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %} 
{% extends 'layout.twig' %}

Also you can deprecate a block in the following way:

{% block hey %} 
    {% deprecated 'The "hey" block is deprecated, use "greet" instead.' %} 
    {{ block('greet') }} 
{% endblock
%}

{% block greet %} 
    Hey you!
{% endblock %} 

Note that by default, the deprecation notices are silenced and never displayed nor logged. See Recipes to learn how to handle them.

Source: Twig



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.