From f1be27301bdd492d1f68fad2e5eaedc9671f9c68 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 16 Jan 2011 08:00:40 +0100 Subject: [PATCH] added a note about the main advantage of creating an extension --- doc/extensions.rst | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/extensions.rst b/doc/extensions.rst index 1c4079b..691ecd5 100644 --- a/doc/extensions.rst +++ b/doc/extensions.rst @@ -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. @@ -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. -- 1.7.2.5