I need replace some content in every file of view. But content in many places is just a text, not a variable, co i cant use
Symfony controller has 2 functions
renderView(), the former renders a view and returns a
Response, the latter just renders the view and returns the string result.
so you could in your action:
$content = $this->renderView('my-view.html.twig', [...]); $content = str_replace('my text', 'my new text', $content); return new Response($content);