custom/static-plugins/SamsonAmpc/src/Subscriber/MediaFileExtensionSubscriber.php line 29

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Samson\Subscriber;
  3. /***
  4.  *
  5.  * This file is part of the "SAMSON Shop" project.
  6.  *
  7.  * For the full copyright and license information, please read the
  8.  * LICENSE.txt file that was distributed with this source code.
  9.  *
  10.  *  (c) 2023
  11.  *
  12.  ***/
  13. use Shopware\Core\Content\Media\Event\MediaFileExtensionWhitelistEvent;
  14. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15. class MediaFileExtensionSubscriber implements EventSubscriberInterface
  16. {
  17.     public static function getSubscribedEvents(): array
  18.     {
  19.         return [
  20.             MediaFileExtensionWhitelistEvent::class => 'addEntryToFileExtensionWhitelist'
  21.         ];
  22.     }
  23.     public function addEntryToFileExtensionWhitelist(MediaFileExtensionWhitelistEvent $event): void
  24.     {
  25.         $whiteList $event->getWhitelist();
  26.         $whiteList[] = 'zip';
  27.         $whiteList[] = 'stl';
  28.         $whiteList[] = 'bin';
  29.         $whiteList[] = 'gltf';
  30.         $whiteList[] = 'glb';
  31.         $event->setWhitelist($whiteList);
  32.     }
  33. }