<?php declare(strict_types=1);
namespace Kilb\KilbShopwareProductDesigner\Subscriber;
use Shopware\Core\Content\Media\Event\MediaFileExtensionWhitelistEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MediaSubscriber implements EventSubscriberInterface
{
/**
* @return array<string, string>
*/
public static function getSubscribedEvents(): array
{
return[
MediaFileExtensionWhitelistEvent::class => 'onWhitelistCheck',
];
}
/**
* @param MediaFileExtensionWhitelistEvent $event
*/
public function onWhitelistCheck(MediaFileExtensionWhitelistEvent $event): void
{
$list = $event->getWhitelist();
$list[] = 'ttf';
$event->setWhitelist($list);
}
}