Pregunta

I have an html saved in my database with a special tag string like [special_tag] and I want to display that html to my twig template at the same time replace the [special_tag] with any html elements.

Is this possible?

¿Fue útil?

Solución

Yes, you could use Twig's replace filter:

{{ my_variable_with_html | replace({'[special_tag]': 'new value'}) }}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top