formatAmountByAccount(), ]; } /** * Will return "active" when a part of the route matches the argument. * ie. "accounts" will match "accounts.index". * * @return Twig_SimpleFunction */ protected function formatAmountByAccount(): Twig_SimpleFunction { return new Twig_SimpleFunction( 'formatAmountByAccount', function (AccountModel $account, string $amount, bool $coloured = true): string { $currencyId = intval($account->getMeta('currency_id')); if ($currencyId === 0) { // Format using default currency: return AmountFacade::format($amount, $coloured); } $currency = TransactionCurrency::find($currencyId); return AmountFacade::formatAnything($currency, $amount, $coloured); }, ['is_safe' => ['html']] ); } }