Possible to modify a static property of Kirby core?

The class within Kirby core’s Sane/Xml.php defines a static property with an array of domains that are accepted for URLs as href attribute values by the sanitizer function for uploaded XML files. It’s an empty array by default, i.e. validation fails on all href attributes with any URL:

namespace Kirby\Sane;
...
class Xml extends Handler
{
  ...
  public static $allowedDomains = [];

Is there some way I can override this property from within a plugin, hook or the like? Something like Xml::$allowedDomains = ['garmin.com'] to replace that default empty array with values that suit my project? And, if technically possible to start with: where would I place such line of code?

Thank you!

(…related to this issue, which only later occured to me might be not a Kirby issue as much as a reflection of my OOP understanding’s boundaries?)

Have you tried to set

Kirby\Sane\Xml::$allowedDomains = ['garmin.com']

in your config?

Don’t know if this also works in a plugin file…, seems to

1 Like

Obviously too obvious :see_no_evil: Thx, @texnixe, this is exactly what I was hoping for – it works like a charm by simply adding it before the return statement in config.php:

<?php
// a list of allowed domains for XML uploads
Kirby\Sane\Xml::$allowedDomains = ['www.garmin.com'];
// then the regular array of config variables
return [
   ...
];

Jep, works just fine like this:

<?php
Kirby\Sane\Xml::$allowedDomains = ['www.garmin.com'];
Kirby::plugin('myname/myplugin', [
   ...
];