I’m currently trying to create a plugin that will transform KeyshapeJS animated SVGs the way I need them. Inside those SVGs are script tags that I need, but Kirby won’t allow them. In general this is obviously the right choice, but in my case I really need them.
In the Kirby Svg class I found the script tag in the $disallowed tags. Is it possible to overwrite this behaviour inside a plugin?
The problem is that for the website I’m currently working on I have to include 130 animated SVGs and doing the needed work by hand takes about 15 minutes per SVG. So any help would be greatly appreciated!
Thanks and all the best
Yes, possible indeed. I got some comprehensive explanations on a similar issue a while back …hope that points you in the right direction? Error uploading standard Garmin GPX tracks · Issue #3433 · getkirby/kirby · GitHub
Thanks @sebastiangreger, you’re the best! In case anyone else needs this, this is what I ended up doing inside my plugin’s index.php:
@include_once __DIR__ . '/vendor/autoload.php';
Kirby\Sane\Svg::$disallowedTags = array_diff(Kirby\Sane\Svg::$disallowedTags, ['script']);
Kirby\Sane\Svg::$allowedTags = array_merge(Kirby\Sane\Svg::$allowedTags, ['script' => true]);