Last Updated: February 25, 2016
·
1.155K
· rodnaph

Twig Filter Escaping

When using filters, by default Twig will automatically try and escape the output data from the last filter in a chain to match the current context (eg. 'html'). If you don't want this behaviour then you need to mark your filter as safe.

'myFilter' => new Twig_Filter_Method(
    $this,
    'myFilter',
    array('is_safe' => array('html'))
);

The end.