Jump to content

How to allow data-attribute in posts?

Go to solution Solved by Stuart Silvester,

Recommended Posts


I need to allow to post an attribute like data-customanchor="value", what is the correct way to do that?

I've tried to play around with setting "Allowed javascript controllers" in editor's settings, but didn't figured out how to use it (also did not found any examples or docs on how to use this setting).


Link to comment
Share on other sites

  • Solution

You would need to write a plugin to overload \IPS\Text\Parser::_htmlPurifierModifyHtmlDefinition() to whitelist your custom attribute on the chosen tag. I would recommend taking a look at that method to see how we're whitelisting certain attributes.

Allowed JavaScript controllers is purely for controllers (data-controller attributes that we use to load JS)

Link to comment
Share on other sites

  • 1 year later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...