Skip to content

Commit f7e806f

Browse files
committed
latte v3.1.6
1 parent 3aa93e0 commit f7e806f

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

latte/cs/extending-latte.texy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ beforeRender(Latte\Runtime\Template $template): void .[method]
163163
Volá se před každým vykreslením šablony. Metoda může být použita například k inicializaci proměnných používaných během vykreslování.
164164

165165

166+
afterRender(Latte\Runtime\Template $template): void .[method]{data-version:3.1.6}
167+
---------------------------------------------------------------------------------
168+
Volá se po každém vykreslení šablony. Spustí se i tehdy, když vykreslování skončí předčasně přes `{exitIf}` nebo je přerušeno výjimkou, takže je vhodná pro úklid nebo měření.
169+
170+
166171
getFilters(): array .[method]
167172
-----------------------------
168173

latte/cs/filters.texy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ V šablonách můžeme používat funkce, které pomáhají upravit nebo přefor
2525
| `last` | [vrací poslední prvek pole nebo znak řetězce |#last]
2626
| `length` | [vrací délku řetězce ve znacích nebo pole |#length]
2727
| `localDate` | [formátuje datum a čas podle národního prostředí |#localDate]
28+
| `map` | [aplikuje callback na každý prvek |#map]
2829
| `number` | [formátuje číslo |#number]
2930
| `padLeft` | [doplní řetězec zleva na požadovanou délku |#padLeft]
3031
| `padRight` | [doplní řetězec zprava na požadovanou délku |#padRight]
@@ -592,6 +593,17 @@ Převede řetězec na malá písmena. Vyžaduje PHP rozšíření `mbstring`.
592593
Viz také [#capitalize], [#firstLower], [#firstUpper], [#upper].
593594

594595

596+
map(callable $transformer): iterable .[filter]{data-version:3.1.6}
597+
------------------------------------------------------------------
598+
Transformuje každý prvek pole nebo iterátoru pomocí callbacku a vrací nový iterátor. Je protějškem filtru [#filter]. Klíče zůstávají zachovány.
599+
600+
```latte
601+
{=($users|map: fn($user) => $user->name)|implode: ', '} {* John, Mary, Paul *}
602+
```
603+
604+
Viz také [#filter].
605+
606+
595607
nocheck .[filter]
596608
-----------------
597609
Předejde automatickému ošetření URL adresy. Latte [automaticky kontroluje |safety-first#Kontrola odkazů], zda URL používá bezpečné schéma (např. `http`, `https`, `ftp`, `mailto`, `tel`, `sms`) nebo jde o relativní odkaz, a blokuje potenciálně nebezpečné.

latte/en/extending-latte.texy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ beforeRender(Latte\Runtime\Template $template): void .[method]
163163
It is called before each template rendering. The method can be used, for example, to initialize variables used during rendering.
164164

165165

166+
afterRender(Latte\Runtime\Template $template): void .[method]{data-version:3.1.6}
167+
---------------------------------------------------------------------------------
168+
It is called after each template rendering. It runs even when rendering ends early via `{exitIf}` or is interrupted by an exception, making it the right place for cleanup or measurement.
169+
170+
166171
getFilters(): array .[method]
167172
-----------------------------
168173

latte/en/filters.texy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ In templates, we can use functions that help modify or reformat data into its fi
2525
| `last` | [returns the last element of an array or character of a string |#last]
2626
| `length` | [returns the length of a string or array |#length]
2727
| `localDate` | [formats the date and time according to the locale |#localDate]
28+
| `map` | [applies a callback to each element |#map]
2829
| `number` | [formats a number |#number]
2930
| `padLeft` | [pads a string to a certain length from the left |#padLeft]
3031
| `padRight` | [pads a string to a certain length from the right |#padRight]
@@ -592,6 +593,17 @@ Converts a string to lowercase. Requires the `mbstring` PHP extension.
592593
See also [#capitalize], [#firstLower], [#firstUpper], [#upper].
593594

594595

596+
map(callable $transformer): iterable .[filter]{data-version:3.1.6}
597+
------------------------------------------------------------------
598+
Transforms each element of an array or iterator using a callback and returns a new iterator. It is the counterpart to the [#filter] filter. The keys are preserved.
599+
600+
```latte
601+
{=($users|map: fn($user) => $user->name)|implode: ', '} {* John, Mary, Paul *}
602+
```
603+
604+
See also [#filter].
605+
606+
595607
nocheck .[filter]
596608
-----------------
597609
Prevents automatic URL sanitization. Latte [automatically checks |safety-first#Link Checking] whether a URL uses a safe scheme (such as `http`, `https`, `ftp`, `mailto`, `tel`, `sms`) or is a relative link, and blocks potentially dangerous ones.

0 commit comments

Comments
 (0)