Преглед изворни кода

[TwigBundle] updated functions to work with the latest version of Twig

Fabien Potencier пре 14 година
родитељ
комит
77f5e7a5f3

+ 2 - 2
src/Symfony/Bundle/TwigBundle/Extension/SecurityExtension.php

@@ -39,10 +39,10 @@ class SecurityExtension extends \Twig_Extension
     /**
      * {@inheritdoc}
      */
-    public function getGlobals()
+    public function getFunctions()
     {
         return array(
-            'fn_has_role' => new \Twig_Function($this, 'vote'),
+            'has_role' => new \Twig_Function_Method($this, 'vote'),
         );
     }
 

+ 5 - 5
src/Symfony/Bundle/TwigBundle/Extension/TemplatingExtension.php

@@ -60,15 +60,15 @@ class TemplatingExtension extends \Twig_Extension
     }
 
     /**
-     * Returns a list of global functions to add to the existing list.
+     * Returns a list of functions to add to the existing list.
      *
-     * @return array An array of global functions
+     * @return array An array of functions
      */
-    public function getGlobals()
+    public function getFunctions()
     {
         return array(
-            'fn_url'  => new \Twig_Function($this, 'getUrl'),
-            'fn_path' => new \Twig_Function($this, 'getPath'),
+            'url'  => new \Twig_Function_Method($this, 'getUrl'),
+            'path' => new \Twig_Function_Method($this, 'getPath'),
         );
     }