* 1.12.1 (2013-XX-XX)
+ * added support for object instances as the second argument of the constant function
* relaxed globals management to avoid a BC break
* added support for {{ some_string[:2] }}
``constant``
============
-.. versionadded: 1.13
- constant() now accepts object instances as the second argument.
+.. versionadded: 1.12.1
+ constant now accepts object instances as the second argument.
``constant`` returns the constant value for a given string:
{{ some_date|date(constant('DATE_W3C')) }}
{{ constant('Namespace\\Classname::CONSTANT_NAME') }}
-As of 1.13 you can read constants from object instances as well:
+As of 1.12.1 you can read constants from object instances as well:
.. code-block:: jinja
}
/**
- * Wrapper around constant() provides the ability to get constants
- * from instances as well as class/global constants.
+ * Provides the ability to get constants from instances as well as class/global constants.
*
- * @param string $constant The name of the constant.
- * @param null|object $object The object to get the constant from.
+ * @param string $constant The name of the constant
+ * @param null|object $object The object to get the constant from
*
* @return string
*/