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
No description
Injects the (system) logger based on PSR-3.
Register a new argument. Call this method from your ViewHelper subclass inside the initializeArguments() method.
Overrides a registered argument. Call this method from your ViewHelper subclass inside the initializeArguments() method if you want to override a previously registered argument.
Get the locale to use for all locale specific functionality.
Initialize the arguments.
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.
protected AbstractViewHelper
registerArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)
Register a new argument. Call this method from your ViewHelper subclass inside the initializeArguments() method.
This exists only to throw our own exception!
protected AbstractViewHelper
overrideArgument(string $name, string $type, string $description, bool $required = false, mixed $defaultValue = null, bool|null $escape = null)
Overrides a registered argument. Call this method from your ViewHelper subclass inside the initializeArguments() method if you want to override a previously registered argument.
This exists only to throw our own exception!
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