<?php declare(strict_types=1);
namespace Crehler\ProductFiles\Subscriber;
use Shopware\Core\Content\Media\Event\MediaFileExtensionWhitelistEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MediaSubscriber implements EventSubscriberInterface
{
/**
* @return array
*/
public static function getSubscribedEvents(): array
{
return [
MediaFileExtensionWhitelistEvent::class => 'onMediaFileExtensionWhitelist',
];
}
public function onMediaFileExtensionWhitelist(MediaFileExtensionWhitelistEvent $event)
{
$whitelist = $event->getWhitelist();
array_push($whitelist, 'zip', 'rar', '7zip', 'docx', 'sb2', 'xls');
$event->setWhitelist($whitelist);
}
}