src/Core/Framework/Plugin/Subscriber/PluginLoadedSubscriber.php line 26

  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\Log\Package;
  5. use Shopware\Core\Framework\Plugin\PluginEntity;
  6. use Shopware\Core\Framework\Plugin\PluginEvents;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. /**
  9.  * @internal
  10.  */
  11. #[Package('core')]
  12. class PluginLoadedSubscriber implements EventSubscriberInterface
  13. {
  14.     public static function getSubscribedEvents(): array
  15.     {
  16.         return [
  17.             PluginEvents::PLUGIN_LOADED_EVENT => [
  18.                 ['unserialize'],
  19.             ],
  20.         ];
  21.     }
  22.     public function unserialize(EntityLoadedEvent $event): void
  23.     {
  24.         /** @var PluginEntity $plugin */
  25.         foreach ($event->getEntities() as $plugin) {
  26.             if ($plugin->getIconRaw()) {
  27.                 $plugin->setIcon(base64_encode($plugin->getIconRaw()));
  28.             }
  29.         }
  30.     }
  31. }