File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -102,14 +102,16 @@ Markdown content into HTML::
102102 }
103103
104104Next, 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 ``
106106class 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')
You can’t perform that action at this time.
0 commit comments