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 @@ -178,6 +178,9 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
178178 use Symfony\Bridge\Twig\Extension\FormExtension;
179179 use Symfony\Component\Form\FormRenderer;
180180 use Symfony\Bridge\Twig\Form\TwigRendererEngine;
181+ use Twig\Environment;
182+ use Twig\Loader\FilesystemLoader;
183+ use Twig\RuntimeLoader\FactoryRuntimeLoader;
181184
182185 // the Twig file that holds all the default markup for rendering forms
183186 // this file comes with TwigBridge
@@ -191,7 +194,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
191194 // the path to your other templates
192195 $viewsDirectory = realpath(__DIR__.'/../views');
193196
194- $twig = new Twig_Environment (new Twig_Loader_Filesystem (array(
197+ $twig = new Environment (new FilesystemLoader (array(
195198 $viewsDirectory,
196199 $vendorTwigBridgeDirectory.'/Resources/views/Form',
197200 )));
@@ -253,7 +256,7 @@ installed:
253256 $ composer require symfony/translation symfony/config
254257
255258 Next, add the :class: `Symfony\\ Bridge\\ Twig\\ Extension\\ TranslationExtension `
256- to your ``Twig_Environment `` instance::
259+ to your ``Twig\\Environment `` instance::
257260
258261 use Symfony\Component\Form\Forms;
259262 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 @@ -26,12 +26,15 @@ Create a class that extends ``\Twig_Extension`` and fill in the logic::
2626 // src/AppBundle/Twig/AppExtension.php
2727 namespace AppBundle\Twig;
2828
29- class AppExtension extends \Twig_Extension
29+ use Twig\Extension\AbstractExtension;
30+ use Twig\TwigFilter;
31+
32+ class AppExtension extends AbstractExtension
3033 {
3134 public function getFilters()
3235 {
3336 return array(
34- new \Twig_SimpleFilter ('price', array($this, 'priceFilter')),
37+ new TwigFilter ('price', array($this, 'priceFilter')),
3538 );
3639 }
3740
You can’t perform that action at this time.
0 commit comments