]>
Commit | Line | Data |
---|---|---|
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 | ||
14 | As of 1.12.1 you can read constants from object instances as well: | |
15 | ||
16 | .. code-block:: jinja | |
17 | ||
18 | {{ constant('RSS', date) }} |