mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 23:17:26 +00:00
Improve batch code example
The current example uses an array of 7 items, resulting in 3 arrays of 3 items each (with fill). This can be misinterpreted at a glance as creating n arrays as opposed to arrays with n items. We should therefore instead use an example array of 4 items resulting in 2 arrays of 3 items each (with fill). I think this would make the functionality less ambiguous.
This commit is contained in:
committed by
Fabien Potencier
parent
8f0f071681
commit
feb9321022
@@ -10,7 +10,7 @@ missing items:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %}
|
||||
{% set items = ['a', 'b', 'c', 'd'] %}
|
||||
|
||||
<table>
|
||||
{% for row in items|batch(3, 'No item') %}
|
||||
@@ -34,11 +34,6 @@ The above example will be rendered as:
|
||||
</tr>
|
||||
<tr>
|
||||
<td>d</td>
|
||||
<td>e</td>
|
||||
<td>f</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>g</td>
|
||||
<td>No item</td>
|
||||
<td>No item</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user