Skip to content

Commit

Permalink
added a note about the main advantage of creating an extension
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 16, 2011
1 parent 4e62a4d commit f1be273
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/extensions.rst
Expand Up @@ -6,6 +6,10 @@ reusable class like adding support for internationalization. An extension can
define tags, filters, tests, operators, global variables, functions, and node
visitors.

Creating an extension also makes for a better separation of code that is
executed at compilation time and code needed at runtime. As such, it makes
your code faster.

Most of the time, it is useful to create a single extension for your project,
to host all the specific tags and filters you want to add to Twig.

Expand All @@ -23,9 +27,9 @@ An extension is a class that implements the following interface::
*
* This is where you can load some file that contains filter functions for instance.
*
* @param Twig_Environment $environement The current Twig_Environment instance
* @param Twig_Environment $environment The current Twig_Environment instance
*/
public function initRuntime(Twig_Environment $environement);
public function initRuntime(Twig_Environment $environment);

/**
* Returns the token parser instances to add to the existing list.
Expand Down

0 comments on commit f1be273

Please sign in to comment.