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
178
178
use Symfony\Bridge\Twig\Extension\FormExtension;
179
179
use Symfony\Component\Form\FormRenderer;
180
180
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
181
+ use Twig\Environment;
182
+ use Twig\Loader\FilesystemLoader;
183
+ use Twig\RuntimeLoader\FactoryRuntimeLoader;
181
184
182
185
// the Twig file that holds all the default markup for rendering forms
183
186
// this file comes with TwigBridge
@@ -191,7 +194,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
191
194
// the path to your other templates
192
195
$viewsDirectory = realpath(__DIR__.'/../views');
193
196
194
- $twig = new Twig_Environment (new Twig_Loader_Filesystem (array(
197
+ $twig = new Environment (new FilesystemLoader (array(
195
198
$viewsDirectory,
196
199
$vendorTwigBridgeDirectory.'/Resources/views/Form',
197
200
)));
@@ -253,7 +256,7 @@ installed:
253
256
$ composer require symfony/translation symfony/config
254
257
255
258
Next, add the :class: `Symfony\\ Bridge\\ Twig\\ Extension\\ TranslationExtension `
256
- to your ``Twig_Environment `` instance::
259
+ to your ``Twig\\Environment `` instance::
257
260
258
261
use Symfony\Component\Form\Forms;
259
262
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 @@ -26,12 +26,15 @@ Create a class that extends ``\Twig_Extension`` and fill in the logic::
26
26
// src/AppBundle/Twig/AppExtension.php
27
27
namespace AppBundle\Twig;
28
28
29
- class AppExtension extends \Twig_Extension
29
+ use Twig\Extension\AbstractExtension;
30
+ use Twig\TwigFilter;
31
+
32
+ class AppExtension extends AbstractExtension
30
33
{
31
34
public function getFilters()
32
35
{
33
36
return array(
34
- new \Twig_SimpleFilter ('price', array($this, 'priceFilter')),
37
+ new TwigFilter ('price', array($this, 'priceFilter')),
35
38
);
36
39
}
37
40
You can’t perform that action at this time.
0 commit comments