mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 20:16:45 +00:00
minor #3006 update docs for for loop with conditional to reference filter filters (shieldo)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #3006).
Discussion
----------
update docs for for loop with conditional to reference filter filters
I don't know if there needs to be the same emphasis for this case as there's no special syntax for this any more? This PR assumes the same emphasis.
Commits
-------
b905e023 update docs for for loop with conditional to reference filter filters
This commit is contained in:
@@ -87,6 +87,13 @@ Variable Description
|
||||
Adding a condition
|
||||
------------------
|
||||
|
||||
.. tip::
|
||||
|
||||
As of Twig 2.10, use the :doc:`filter <../filters/filter>` filter instead,
|
||||
or an ``if`` condition inside the ``for`` body (if your condition
|
||||
depends on a variable updated inside the loop and you are not using the
|
||||
``loop`` variable).
|
||||
|
||||
Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You
|
||||
can however filter the sequence during iteration which allows you to skip
|
||||
items. The following example skips all the users which are not active:
|
||||
|
||||
Reference in New Issue
Block a user