Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #2884 Fix "batch filter clobbers array keys when fill parameter i…
…s used " (fabpot) This PR was squashed before being merged into the 1.x branch (closes #2884). Discussion ---------- Fix "batch filter clobbers array keys when fill parameter is used " closes #2568 Commits ------- 750cb23 fixed batch filter clobbers array keys when fill parameter is used ede9a60 added preserveKeys support for the batch filter
- Loading branch information
Showing
4 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/Twig/Tests/Fixtures/filters/batch_with_more_elements.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
"batch" filter | ||
--TEMPLATE-- | ||
{% for row in items|batch(3, 'fill') %} | ||
<div class=row> | ||
{% for key, column in row %} | ||
<div class={{ key }}>{{ column }}</div> | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
--DATA-- | ||
return ['items' => ['a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', '123' => 'e']] | ||
--EXPECT-- | ||
<div class=row> | ||
<div class=a>a</div> | ||
<div class=b>b</div> | ||
<div class=c>c</div> | ||
</div> | ||
<div class=row> | ||
<div class=d>d</div> | ||
<div class=123>e</div> | ||
<div class=124>fill</div> | ||
</div> |