Check if icon exist

Given a random string, Is there a way to check if that is an available icon within the current Kirby setup (which can be used directy in an k-icon html tag as type), or if it should be tried as an emoji?

You can get all icons like this:

$svg = new SimpleXMLElement(F::read(kirby()->root('panel') . '/dist/img/icons.svg'));
$icons = [];
foreach ($svg->defs->children() as $symbol) {
    array_push($icons, str_replace('icon-', '', $symbol->attributes()->id));
}

Then you can check with in_array("random-string", $icons) if it exists.

Seems to work great.

For now cached it and made it a SiteMethod getter.
Hopefully these things won’t hurt performance too much