mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 20:47:28 +00:00
changed the documentation to advertize null as begin the null value and none as an alias
This commit is contained in:
+1
-1
@@ -300,7 +300,7 @@ The ``core`` extension defines all the core features of Twig:
|
||||
* ``odd``
|
||||
* ``defined``
|
||||
* ``sameas``
|
||||
* ``none``
|
||||
* ``null``
|
||||
* ``divisibleby``
|
||||
* ``constant``
|
||||
* ``empty``
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ That way you can access the attributes:
|
||||
<dt>Username</dt>
|
||||
<dd>{{ forms.input('username') }}</dd>
|
||||
<dt>Password</dt>
|
||||
<dd>{{ forms.input('password', none, 'password') }}</dd>
|
||||
<dd>{{ forms.input('password', null, 'password') }}</dd>
|
||||
</dl>
|
||||
<p>{{ forms.textarea('comment') }}</p>
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ The macro can then be called at will:
|
||||
.. code-block:: jinja
|
||||
|
||||
<p>{{ forms.input('username') }}</p>
|
||||
<p>{{ forms.input('password', none, 'password') }}</p>
|
||||
<p>{{ forms.input('password', null, 'password') }}</p>
|
||||
|
||||
If macros are defined and used in the same template, you can use the
|
||||
special ``_self`` variable, without importing them:
|
||||
|
||||
+2
-2
@@ -480,8 +480,8 @@ exist:
|
||||
* ``true`` / ``false``: ``true`` represents the true value, ``false``
|
||||
represents the false value.
|
||||
|
||||
* ``none``: ``none`` represents no specific value (the equivalent of ``null`` in
|
||||
PHP). This is the value returned when a variable does not exist.
|
||||
* ``null``: ``null`` represents no specific value. This is the value returned
|
||||
when a variable does not exist. ``none`` is an alias for ``null``.
|
||||
|
||||
Arrays and hashes can be nested:
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ Tests
|
||||
:maxdepth: 1
|
||||
|
||||
divisibleby
|
||||
none
|
||||
null
|
||||
even
|
||||
odd
|
||||
sameas
|
||||
|
||||
+7
-3
@@ -1,8 +1,12 @@
|
||||
``none``
|
||||
``null``
|
||||
========
|
||||
|
||||
``none`` returns ``true`` if the variable is ``none``:
|
||||
``null`` returns ``true`` if the variable is ``null``:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ var is none }}
|
||||
{{ var is null }}
|
||||
|
||||
.. note::
|
||||
|
||||
``none`` is an alias for ``null``.
|
||||
|
||||
Reference in New Issue
Block a user