Commit 9c56d19f authored by Fabien Potencier's avatar Fabien Potencier

removed the twig.configure service

parent 9766faf0
Changelog
=========
This changelog references all backward incompatibilities as we introduce them:
* **2012-06-15**: removed the ``twig.configure`` service. Use the ``extend``
method instead:
Before::
$app['twig.configure'] = $app->protect(function ($twig) use ($app) {
// do something
});
After::
$app['twig'] = $app->extend('twig', function($twig, $app) {
// do something
return $twig;
});
* **2012-06-13**: Added a route ``before`` middleware
......
......@@ -25,10 +25,6 @@ Services
* **twig**: The ``Twig_Environment`` instance. The main way of
interacting with Twig.
* **twig.configure**: :doc:`Protected closure </services#protected-closures>`
that takes the Twig environment as an argument. You can use it to add more
custom globals.
* **twig.loader**: The loader for Twig templates which uses the ``twig.path``
and the ``twig.templates`` options. You can also replace the loader
completely.
......@@ -118,5 +114,18 @@ from a template:
{# or if you are also using UrlGeneratorServiceProvider with the SymfonyBridgesServiceProvider #}
{{ render(path('sidebar')) }}
Customization
-------------
You can configure the Twig environment before using it by extending the
``twig`` service::
$app['twig'] = $app->extend('twig', function($twig, $app) {
$twig->addGlobal('pi', 3.14);
$twig->addFilter('levenshtein', new \Twig_Filter_Function('levenshtein'));
return $twig;
});
For more information, check out the `Twig documentation
<http://twig.sensiolabs.org>`_.
......@@ -74,7 +74,7 @@ class TwigServiceProvider implements ServiceProviderInterface
}
if (isset($app['twig.configure'])) {
$app['twig.configure']($twig);
throw new \RuntimeException('The twig.configure service has been removed. Read the changelog to learn how you can upgrade your code.');
}
return $twig;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment