1

I am building a section in which a client will list their various social network connections. There are fields for each social network's name and icon, as well as a field with the URL to the client's page on the specified network.

I also need a field that contains the code needed for each network's "Share" button. The code for "Share" buttons varies, but typically includes some HTML as well as <script> tags. When I output this field in a template, its contents are HTML encoded and displayed literally.

How can I keep this from being encoded so the HTML and Javascript can be parsed by the browser?

Philip Jones
  • 476
  • 3
  • 10

1 Answers1

3

Giving the enduser the ability to include scripts is risky way to present social media links. Any errors could protentialy break the entire html page / site If you really want to do it this way you can use twig's raw filter

Moto_Nomad
  • 325
  • 1
  • 7
  • That works perfectly, thanks! Fortunately, in my case, there is only one "end user." I would never implement something like that on site where the content of that field couldn't be controlled. – Philip Jones Oct 17 '16 at 18:43