class CurrencyViewHelper extends AbstractLocaleAwareViewHelper (View source)

Formats a given float to a currency representation.

= Examples =

123.456 ``` 123,46 54321 ``` 54,321.00 $ {someNumber -> f:format.currency(thousandsSeparator: ',', currencySign: '€')} ``` 54,321,00 € (depending on the value of {someNumber}) {someNumber -> f:format.currency(currencySign: '€', forceLocale: true)} ``` 54.321,00 € (depending on the value of {someNumber} and the current locale) {someNumber -> f:format.currency(currencySign: 'EUR', forceLocale: 'de_DE')} ``` 54.321,00 EUR (depending on the value of {someNumber}) {someNumber -> f:format.currency(currencySign: '€', prependCurrency: 'true')} ``` € 54.321,00 (depending on the value of {someNumber}) {someNumber -> f:format.currency(currencySign: '€', separateCurrency: 'false', decimals: '0')} ``` 54.321€ (depending on the value of {someNumber}) 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 RenderingContextInterface $renderingContext from  AbstractViewHelper
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

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

void
injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

injectLocalizationService(Service $localizationService)

No description

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

Parameters

RenderingContextInterface $renderingContext

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

Parameters

LoggerInterface $logger

Return Value

void

bool isEscapingInterceptorEnabled()

No description

Return Value

bool

__construct()

Constructor

injectLocalizationService(Service $localizationService)

No description

Parameters

Service $localizationService

protected Locale getLocale()

Get the locale to use for all locale specific functionality.

Return Value

Locale

The locale to use or NULL if locale should not be used

Exceptions

InvalidVariableException

void initializeArguments()

Initialize the arguments.

Return Value

void

string render()

No description

Return Value

string

the formatted amount.

Exceptions

InvalidVariableException
Exception