Fixed various currency displays.

This commit is contained in:
James Cole
2017-06-06 07:18:09 +02:00
parent a7412e43b3
commit 5329e026dc
6 changed files with 41 additions and 11 deletions

View File

@@ -52,6 +52,7 @@ class AmountFormat extends Twig_Extension
$this->formatDestinationBefore(),
$this->formatSourceAfter(),
$this->formatSourceBefore(),
$this->formatAmountByCurrency(),
];
}
@@ -107,6 +108,23 @@ class AmountFormat extends Twig_Extension
);
}
/**
* Will format the amount by the currency related to the given account.
*
* @return Twig_SimpleFunction
*/
protected function formatAmountByCurrency(): Twig_SimpleFunction
{
return new Twig_SimpleFunction(
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
return app('amount')->formatAnything($currency, $amount, $coloured);
}, ['is_safe' => ['html']]
);
}
/**
* @return Twig_SimpleFilter
*/