Skip to content
Browse files

Making docs more explict as to what kind of object can be

used with Twig_Function_Method.
Fixes #308
  • Loading branch information...
1 parent 612fa7b commit c178c2818ec3022b7e6302029065b09808e27fcf @markstory markstory committed Jun 26, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 doc/advanced.rst
5 doc/advanced.rst
@@ -264,6 +264,11 @@ Adding a function is similar to adding a filter. This can be done by calling the
$twig = new Twig_Environment($loader);
$twig->addFunction('functionName', new Twig_Function_Function('someFunction'));
+You can also expose extension methods as functions in your templates::
+ // $this is an object that implements instance of Twig_ExtensionInterface.
+ $twig = new Twig_Environment($loader);
$twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod'));
Functions also support ``needs_environment`` and ``is_safe`` parameters.

0 comments on commit c178c28

Please sign in to comment.
Something went wrong with that request. Please try again.