add asInt filter for web templates
authorKonrad Rosenbaum <konrad@silmor.de>
Sun, 27 Sep 2015 18:57:56 +0000 (20:57 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Sun, 27 Sep 2015 18:57:56 +0000 (20:57 +0200)
www/inc/rendering/twig_extensions.php

index ab32224..8cc1c3d 100644 (file)
@@ -58,6 +58,7 @@ class SmokeFilterExtension extends Twig_Extension
                        'isFalse'  => new Twig_Filter_Method($this, 'isFalse'),
                        'isNull'  => new Twig_Filter_Method($this, 'isFalse'),
                        'getClass' => new Twig_Filter_Method($this, 'getClass'),
+                       'asInt'  => new Twig_Filter_Method($this, 'asInt'),
                );
        }
        
@@ -74,6 +75,7 @@ class SmokeFilterExtension extends Twig_Extension
                else
                        return "basic:".gettype($o);
        }
+       public function asInt($v){return $v+0;}
        
        public function getName()
        {