mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-17 04:46:49 +00:00
added a note about accessing variable attributes that contains operators (closes #775)
This commit is contained in:
@@ -74,6 +74,15 @@ properties of a PHP object, or items of a PHP array), or the so-called
|
||||
{{ foo.bar }}
|
||||
{{ foo['bar'] }}
|
||||
|
||||
When the attribute contains special characters (like ``-`` that would be
|
||||
interpreted as the minus operator), use the ``attribute`` function instead to
|
||||
access the variable attribute:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{# equivalent to the non-working foo.data-foo #}
|
||||
{{ attribute(foo, 'data-foo') }}
|
||||
|
||||
.. note::
|
||||
|
||||
It's important to know that the curly braces are *not* part of the
|
||||
|
||||
Reference in New Issue
Block a user