File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,9 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
181181 use Symfony\Bridge\Twig\Extension\FormExtension;
182182 use Symfony\Bridge\Twig\Form\TwigRenderer;
183183 use Symfony\Bridge\Twig\Form\TwigRendererEngine;
184+ use Twig\Environment;
185+ use Twig\Loader\FilesystemLoader;
186+ use Twig\RuntimeLoader\FactoryRuntimeLoader;
184187
185188 // the Twig file that holds all the default markup for rendering forms
186189 // this file comes with TwigBridge
@@ -194,7 +197,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
194197 // the path to your other templates
195198 $viewsDirectory = realpath(__DIR__.'/../views');
196199
197- $twig = new Twig_Environment (new Twig_Loader_Filesystem (array(
200+ $twig = new Environment (new FilesystemLoader (array(
198201 $viewsDirectory,
199202 $vendorTwigBridgeDirectory.'/Resources/views/Form',
200203 )));
@@ -251,7 +254,7 @@ installed:
251254 $ composer require symfony/translation symfony/config
252255
253256 Next, add the :class: `Symfony\\ Bridge\\ Twig\\ Extension\\ TranslationExtension `
254- to your ``Twig_Environment `` instance::
257+ to your ``Twig\\Environment `` instance::
255258
256259 use Symfony\Component\Form\Forms;
257260 use Symfony\Component\Translation\Translator;
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ called to determine the default escaping applied to the template.
8484base_template_class
8585~~~~~~~~~~~~~~~~~~~
8686
87- **type **: ``string `` **default **: ``'Twig_Template ' ``
87+ **type **: ``string `` **default **: ``'Twig\\Template ' ``
8888
8989Twig templates are compiled into PHP classes before using them to render
9090contents. This option defines the base class from which all the template classes
Original file line number Diff line number Diff line change @@ -33,12 +33,15 @@ As an example you'll create a price filter to format a given number into price::
3333 // src/AppBundle/Twig/AppExtension.php
3434 namespace AppBundle\Twig;
3535
36- class AppExtension extends \Twig_Extension
36+ use Twig\Extension\AbstractExtension;
37+ use Twig\TwigFilter;
38+
39+ class AppExtension extends AbstractExtension
3740 {
3841 public function getFilters()
3942 {
4043 return array(
41- new \Twig_SimpleFilter ('price', array($this, 'priceFilter')),
44+ new TwigFilter ('price', array($this, 'priceFilter')),
4245 );
4346 }
4447
You can’t perform that action at this time.
0 commit comments