mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 03:46:39 +00:00
Merge branch '1.x' into 2.x
* 1.x: Update .travis.yml fiwed internal link Make sure twig_include returns a string
This commit is contained in:
@@ -12,6 +12,7 @@ matrix:
|
||||
- php: 7.0
|
||||
- php: 7.1
|
||||
- php: 7.2
|
||||
- php: 7.3
|
||||
- php: nightly
|
||||
fast_finish: true
|
||||
|
||||
|
||||
@@ -14,11 +14,10 @@ The ``json_encode`` filter returns the JSON representation of a value:
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* ``options``: A bitmask of `json_encode options`_ (``{{
|
||||
* ``options``: A bitmask of `json_encode options`_: ``{{
|
||||
data|json_encode(constant('JSON_PRETTY_PRINT')) }}``.
|
||||
Combine constants using `Twig's bitwise operators`: ``{{
|
||||
data|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_HEX_QUOT') }}``)
|
||||
Combine constants using :ref:`bitwise operators<template_logic>`:
|
||||
``{{ data|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_HEX_QUOT') }}``
|
||||
|
||||
.. _`json_encode`: https://secure.php.net/json_encode
|
||||
.. _`json_encode options`: https://secure.php.net/manual/en/json.constants.php
|
||||
.. _`Twig's bitwise operators`: https://twig.symfony.com/doc/2.x/templates.html#logic
|
||||
|
||||
+3
-1
@@ -651,6 +651,8 @@ but exists for completeness' sake. The following operators are supported:
|
||||
* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 **
|
||||
3 }}`` would return ``8``.
|
||||
|
||||
.. _template_logic:
|
||||
|
||||
Logic
|
||||
~~~~~
|
||||
|
||||
@@ -666,7 +668,7 @@ You can combine multiple expressions with the following operators:
|
||||
|
||||
.. note::
|
||||
|
||||
Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``).
|
||||
Twig also supports bitwise operators (``b-and``, ``b-xor``, and ``b-or``).
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1310,7 +1310,7 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = a
|
||||
}
|
||||
}
|
||||
|
||||
$result = null;
|
||||
$result = '';
|
||||
try {
|
||||
$result = $env->resolveTemplate($template)->render($variables);
|
||||
} catch (Twig_Error_Loader $e) {
|
||||
|
||||
Reference in New Issue
Block a user