]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/twig/twig/doc/functions/constant.rst
gitignore vendor
[github/wallabag/wallabag.git] / vendor / twig / twig / doc / functions / constant.rst
CommitLineData
4f5b44bd
NL
1``constant``
2============
3
4.. versionadded: 1.12.1
5 constant now accepts object instances as the second argument.
6
7``constant`` returns the constant value for a given string:
8
9.. code-block:: jinja
10
11 {{ some_date|date(constant('DATE_W3C')) }}
12 {{ constant('Namespace\\Classname::CONSTANT_NAME') }}
13
14As of 1.12.1 you can read constants from object instances as well:
15
16.. code-block:: jinja
17
18 {{ constant('RSS', date) }}