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:
y2keeper
2020-05-22 14:55:16 +01:00
committed by Fabien Potencier
parent 8f0f071681
commit feb9321022
+1 -6
View File
@@ -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>