I created a custom template for my programmatically created block.
I defined a variable for the template called test
so in my render array I have
'#test' => $node->get('body')->value
Problem is when I print {{ test }}
in my twig template, it literally prints the html rather than rendering it. Ex: <p> My node body </p>
I've also have tried:
'#test' => $node
Then on twig {{ test.body.value }}
but same result, the html does not get rendered.
The only way I found to make render is by doing {{ test.body.value|raw }}
but raw filter should never be used on user entered data.
How can I make Drupal stop escaping the html safely?