CurrencyViewHelper
class CurrencyViewHelper extends AbstractLocaleAwareViewHelper (View source)
Formats a given float to a currency representation.
= Examples =
54321
```
{someNumber -> f:format.currency(thousandsSeparator: ',', currencySign: '€')}
```
{someNumber -> f:format.currency(currencySign: '€', forceLocale: true)}
```
{someNumber -> f:format.currency(currencySign: 'EUR', forceLocale: 'de_DE')}
```
{someNumber -> f:format.currency(currencySign: '€', prependCurrency: 'true')}
```
{someNumber -> f:format.currency(currencySign: '€', separateCurrency: 'false', decimals: '0')}
```
Note: This ViewHelper is intended to help you with formatting numbers into monetary units.
Complex calculations and/or conversions should be done before the number is passed.
Also be aware that if the ``locale`` is set, all arguments except for the currency sign (which
then becomes mandatory) are ignored and the CLDR (Common Locale Data Repository) is used for formatting.
Fore more information about localization see section ``Internationalization & Localization Framework`` in the
Flow documentation.
Additionally, if ``currencyCode`` is set, rounding and decimal digits are replaced by the rules for the
respective currency (e.g. JPY never has decimal digits, CHF is rounded using 5 decimals.)
Properties
protected ControllerContext | $controllerContext | Controller Context to use |
from AbstractViewHelper |
protected ObjectManagerInterface | $objectManager | from AbstractViewHelper | |
protected LoggerInterface | $logger | from AbstractViewHelper | |
protected Service | $localizationService | from AbstractLocaleAwareViewHelper | |
protected NumberFormatter | $numberFormatter |
Methods
void
setRenderingContext(RenderingContextInterface $renderingContext)
No description
from
AbstractViewHelper
void
from
AbstractViewHelper
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
from
AbstractViewHelper
getLocale()
Get the locale to use for all locale specific functionality.
void
initializeArguments()
Initialize the arguments.
string
render()
No description
Details
void
setRenderingContext(RenderingContextInterface $renderingContext)
No description
void
injectObjectManager(ObjectManagerInterface $objectManager)
No description
void
injectLogger(LoggerInterface $logger)
Injects the (system) logger based on PSR-3.
bool
isEscapingInterceptorEnabled()
No description
__construct()
Constructor
injectLocalizationService(Service $localizationService)
No description
protected Locale
getLocale()
Get the locale to use for all locale specific functionality.
void
initializeArguments()
Initialize the arguments.
string
render()
No description