I have an entity with a text-type attribute called contactInfo
. Users can only submit text without html when entering these details in a form. Often an email address is entered somewhere in this textarea (together with more details).
Now when I display this contactInfo
I would like adjust any email address to an email address with a mailto hyperlink. For example
Email us at: example@email.com.
should become:
Email us at: <a href="mailto:example@email.com">example@email.com</a>.
How to go about this? Can I do this directly in Twig with some RegEx or Replace filter? Or should I really do this in the controller?