elleracompany / craft-cookie-consent

GDPR-Compliant cookie consent banner for Craft CMS
Other
6 stars 5 forks source link

Allow message text to include HTML #98

Closed piotrpog closed 4 months ago

piotrpog commented 1 year ago

Right now when we enter some HTML into it, it is escaped into html entities.

nevsie commented 1 year ago

If you take over the template for this, then you can change the tag to output that content as RAW and this will then display HTML as HTML. For example...

I copied the template from /vendor/elleracompany/src/templates/banner.twig Into my craft templates - /cookie-consent/banner.twig

Then I replaced the hook tag: {% hook 'after-body-start' %} With an include of the new template I just made: {% include 'cookie-consent/banner' %}

Then within this template file i changed: {{ craft.cookieConsent.description }} to: {{ craft.cookieConsent.description|raw }}

Then the description from the site settings section for the plugin can have html in it.

jellingsen commented 4 months ago

I think this should be escaped in the plugin by default, and @nevsie 's solution is correct.