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.
Written by Rhodri Pugh
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Did you know?
PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#