// We use this to inject a call to render_var -> TwigExtension->renderVar()
// before anything is printed.
if ($node instanceof PrintNode
) { if (!
empty($this->skipRenderVarFunction
)) { // No need to add the callback, we have escape active already.
unset($this->skipRenderVarFunction
);
return $node;
} $class =
get_class($node);
$line =
$node->
getTemplateLine();
return new $class( new FunctionExpression('render_var',
new Node([$node->
getNode('expr'
)]),
$line),
$line );
} // Change the 'escape' filter to our own 'drupal_escape' filter.
elseif ($node instanceof FilterExpression
) { $name =
$node->
getNode('filter'
)->
getAttribute('value'
);
if ('escape' ==
$name || 'e' ==
$name) { // Use our own escape filter that is MarkupInterface aware.
$node->
getNode('filter'
)->
setAttribute('value', 'drupal_escape'
);
// Store that we have a filter active already that knows