diff options
author | Fabian Becker <halfdan@xnorfz.de> | 2013-04-06 14:06:14 +0400 |
---|---|---|
committer | Fabian Becker <halfdan@xnorfz.de> | 2013-04-06 14:06:14 +0400 |
commit | 1fe5921df39eac77615d9b14b801aab69c3408a4 (patch) | |
tree | 3a5442d7b98c517c440c7b3b731e6972201a4324 /core/Twig.php | |
parent | 92748d5475d69faede7e3a46fbc5e8d4b21c1ade (diff) |
New money filter in Twig.php
Converted lastVisits.twig
Diffstat (limited to 'core/Twig.php')
-rw-r--r-- | core/Twig.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/Twig.php b/core/Twig.php index 24275a5334..4bf72c3bff 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -165,6 +165,17 @@ class Piwik_Twig return Piwik::getPrettyTimeFromSeconds($numberOfSeconds); }); $this->twig->addFilter($sumtimeFilter); + + $moneyFilter = new Twig_SimpleFilter('money', function($amount) + { + if (func_num_args() != 2) { + throw new Exception('the smarty modifier money expects one parameter: the idSite.'); + } + $idSite = func_get_args(); + $idSite = $idSite[1]; + return Piwik::getPrettyMoney($amount, $idSite); + }); + $this->twig->addFilter($moneyFilter); } private function addPluginNamespaces(Twig_Loader_Filesystem $loader) |