Skip to content

Commit 0944c6d

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: More fixes about Twig classes namespaces
2 parents ee8f1d0 + 77246b5 commit 0944c6d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

best_practices/templates.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,16 @@ Markdown content into HTML::
102102
}
103103

104104
Next, create a new Twig extension and define a new filter called ``md2html``
105-
using the ``Twig_SimpleFilter`` class. Inject the newly defined ``Markdown``
105+
using the ``Twig\TwigFilter`` class. Inject the newly defined ``Markdown``
106106
class in the constructor of the Twig extension::
107107

108108
namespace AppBundle\Twig;
109109

110110
use AppBundle\Utils\Markdown;
111+
use Twig\Extension\AbstractExtension;
112+
use Twig\TwigFilter;
111113

112-
class AppExtension extends \Twig_Extension
114+
class AppExtension extends AbstractExtension
113115
{
114116
private $parser;
115117

@@ -121,7 +123,7 @@ class in the constructor of the Twig extension::
121123
public function getFilters()
122124
{
123125
return array(
124-
new \Twig_SimpleFilter(
126+
new TwigFilter(
125127
'md2html',
126128
array($this, 'markdownToHtml'),
127129
array('is_safe' => array('html'), 'pre_escape' => 'html')

0 commit comments

Comments
 (0)