emailencodingfilterbolt-cms

Custom field filter in Bolt CMS admin panel


Is it possible to add custom filter (or validator) to admin panel when saving content type item? For example, I need to check whether the field contains e-mail address and transform it to some encoded text.

When enter to the field this text:

You can contact us - test@test.com

an e-mail "test@test.com" must be found, converted to base64, and in the database must be saved this text:

You can contact us - <script>
document.write(window.atob("dGVzdEB0ZXN0LmNvbQ=="));
</script>

It's needed to prevent read e-mails by spam-bots.

Or if there is other solution in Bolt CMS I will be grateful for the hint.


Solution

  • I wrote my own extension that add twig filter to obfuscate emails in frontend. It is a better way than store encoded emails in database. Maybe it will help to someone - https://market.bolt.cm/view/zinitsolutionsgmbh/bolt3-twig-emailobfuscator