4 .. versionadded: 1.12.1
5 constant now accepts object instances as the second argument.
8 Using ``constant`` with the ``defined`` test was added in Twig 1.28.
10 ``constant`` returns the constant value for a given string:
14 {{ some_date|date(constant('DATE_W3C')) }}
15 {{ constant('Namespace\\Classname::CONSTANT_NAME') }}
17 As of 1.12.1 you can read constants from object instances as well:
21 {{ constant('RSS', date) }}
23 Use the ``defined`` test to check if a constant is defined:
27 {% if constant('SOME_CONST') is defined %}