custom/plugins/CkoShopware6/src/Subscriber/MediaSubscriber.php line 17

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Cko\Shopware6\Subscriber;
  3. use Shopware\Core\Content\Media\Event\MediaFileExtensionWhitelistEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class MediaSubscriber implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents(): array
  8.     {
  9.         return [
  10.             MediaFileExtensionWhitelistEvent::class => 'onMediaFileExtensionWhitelist',
  11.         ];
  12.     }
  13.     public function onMediaFileExtensionWhitelist(MediaFileExtensionWhitelistEvent $event): void
  14.     {
  15.         $newWhiteList array_merge([
  16.             'key',
  17.             'pem',
  18.         ], $event->getWhitelist());
  19.         $event->setWhitelist($newWhiteList);
  20.     }
  21. }