PriceLatteExtension
extends Extension
in package
Table of Contents
Properties
- $appContext : AppContext
- $priceFormatContext : PriceFormatContext
- $unitFormatter : CurrencyUnitFormatter
Methods
- __construct() : mixed
- getFilters() : array<string|int, mixed>
- getFunctions() : array<string|int, mixed>
- Registers the template functions.
- resolveDecimalSeparator() : string
- Decimal separator of the document/request localization (comma when unknown).
- resolveLocalization() : object|null
- Resolves the localization from the invoice override first, then from the current request.
Properties
$appContext read-only
private
AppContext
$appContext
$priceFormatContext read-only
private
PriceFormatContext
$priceFormatContext
$unitFormatter
private
CurrencyUnitFormatter
$unitFormatter
Methods
__construct()
public
__construct(AppContext $appContext, PriceFormatContext $priceFormatContext) : mixed
Parameters
- $appContext : AppContext
- $priceFormatContext : PriceFormatContext
getFilters()
public
getFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>getFunctions()
Registers the template functions.
public
getFunctions() : array<string|int, mixed>
priceSymbolPosition($currency) returns the currency symbol position (a after the amount,
b before it), resolved the same way as the priceFormat filter (localization, then currency).
Front end JS reads it (data-currency-position in parts/shared/scripts.latte), so "12,10 €"
from PHP and an amount computed in JS never differ on one page.
Return values
array<string|int, mixed>resolveDecimalSeparator()
Decimal separator of the document/request localization (comma when unknown).
private
resolveDecimalSeparator() : string
Return values
stringresolveLocalization()
Resolves the localization from the invoice override first, then from the current request.
private
resolveLocalization() : object|null
IMPORTANT: the order matters. An invoice stores its localization at creation, so a regenerated PDF is formatted like the original; with the reverse order it would change when an admin opens it under a different localization. See PriceFormatContext.