File tree 3 files changed +11
-5
lines changed
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
181
181
use Symfony\Bridge\Twig\Extension\FormExtension;
182
182
use Symfony\Bridge\Twig\Form\TwigRenderer;
183
183
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
184
+ use Twig\Environment;
185
+ use Twig\Loader\FilesystemLoader;
186
+ use Twig\RuntimeLoader\FactoryRuntimeLoader;
184
187
185
188
// the Twig file that holds all the default markup for rendering forms
186
189
// this file comes with TwigBridge
@@ -194,7 +197,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
194
197
// the path to your other templates
195
198
$viewsDirectory = realpath(__DIR__.'/../views');
196
199
197
- $twig = new Twig_Environment (new Twig_Loader_Filesystem (array(
200
+ $twig = new Environment (new FilesystemLoader (array(
198
201
$viewsDirectory,
199
202
$vendorTwigBridgeDirectory.'/Resources/views/Form',
200
203
)));
@@ -251,7 +254,7 @@ installed:
251
254
$ composer require symfony/translation symfony/config
252
255
253
256
Next, add the :class: `Symfony\\ Bridge\\ Twig\\ Extension\\ TranslationExtension `
254
- to your ``Twig_Environment `` instance::
257
+ to your ``Twig\\Environment `` instance::
255
258
256
259
use Symfony\Component\Form\Forms;
257
260
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.
84
84
base_template_class
85
85
~~~~~~~~~~~~~~~~~~~
86
86
87
- **type **: ``string `` **default **: ``'Twig_Template ' ``
87
+ **type **: ``string `` **default **: ``'Twig\\Template ' ``
88
88
89
89
Twig templates are compiled into PHP classes before using them to render
90
90
contents. 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::
33
33
// src/AppBundle/Twig/AppExtension.php
34
34
namespace AppBundle\Twig;
35
35
36
- class AppExtension extends \Twig_Extension
36
+ use Twig\Extension\AbstractExtension;
37
+ use Twig\TwigFilter;
38
+
39
+ class AppExtension extends AbstractExtension
37
40
{
38
41
public function getFilters()
39
42
{
40
43
return array(
41
- new \Twig_SimpleFilter ('price', array($this, 'priceFilter')),
44
+ new TwigFilter ('price', array($this, 'priceFilter')),
42
45
);
43
46
}
44
47
You can’t perform that action at this time.
0 commit comments