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

used with Twig_Function_Method.
Fixes #308
This commit is contained in:
Mark Story
2011-06-26 17:31:56 -04:00
parent 612fa7bc51
commit c178c2818e
+5
View File
@@ -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.