aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/twig/twig/doc/functions/constant.rst
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twig/twig/doc/functions/constant.rst')
-rw-r--r--vendor/twig/twig/doc/functions/constant.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/twig/twig/doc/functions/constant.rst b/vendor/twig/twig/doc/functions/constant.rst
new file mode 100644
index 00000000..bea0e9fc
--- /dev/null
+++ b/vendor/twig/twig/doc/functions/constant.rst
@@ -0,0 +1,18 @@
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) }}