platform/src/Core/Framework/Plugin/Subscriber/PluginLoadedSubscriber.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Plugin\Subscriber;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  4. use Shopware\Core\Framework\Plugin\PluginEntity;
  5. use Shopware\Core\Framework\Plugin\PluginEvents;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class PluginLoadedSubscriber implements EventSubscriberInterface
  8. {
  9.     public static function getSubscribedEvents(): array
  10.     {
  11.         return [
  12.             PluginEvents::PLUGIN_LOADED_EVENT => [
  13.                 ['unserialize'],
  14.             ],
  15.         ];
  16.     }
  17.     public function unserialize(EntityLoadedEvent $event): void
  18.     {
  19.         /** @var PluginEntity $plugin */
  20.         foreach ($event->getEntities() as $plugin) {
  21.             if ($plugin->getIconRaw()) {
  22.                 $plugin->setIcon(base64_encode($plugin->getIconRaw()));
  23.             }
  24.         }
  25.     }
  26. }