mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-09 00:46:31 +00:00
minor #3340 Improve batch code example (y2keeper)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead.
Discussion
----------
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.
Commits
-------
feb93210 Improve batch code example
This commit is contained in:
@@ -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