app/Plugin/ProductHide42/Event.php line 80

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the ProductHide42 Plugin
  4.  *
  5.  * Copyright (C) 2023 Diezon.
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Plugin\ProductHide42;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Eccube\Event\EccubeEvents;
  13. use Eccube\Event\EventArgs;
  14. use Eccube\Event\TemplateEvent;
  15. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  16. use Plugin\ProductHide42\Service\ProductHideService;
  17. class Event implements EventSubscriberInterface
  18. {
  19.     /**
  20.      * @var ProductHideService
  21.      */
  22.     protected $productHideService;
  23.     /**
  24.      * Event constructor.
  25.      *
  26.      * @param ProductHideService $productHideService
  27.      */
  28.     public function __construct(ProductHideService $productHideService)
  29.     {
  30.         $this->productHideService $productHideService;
  31.     }
  32.     /**
  33.      * @return array
  34.      */
  35.     public static function getSubscribedEvents()
  36.     {
  37.         return [
  38.             EccubeEvents::ADMIN_PRODUCT_CSV_EXPORT => 'onAdminProductCsvExport',
  39.             '@admin/Product/product.twig' => 'onAdminProductProductTwig',
  40.             '@admin/Product/index.twig' => 'onAdminProductIndexTwig',
  41.             'Product/detail.twig' => 'onProductDetailTwig',
  42.             'Cart/index.twig' => 'onCartIndexTwig',
  43.             'Mypage/history.twig' => 'onMypageHistoryTwig',
  44.         ];
  45.     }
  46.     /**
  47.      * @param EventArgs $event
  48.      */
  49.     public function onAdminProductCsvExport(EventArgs $event)
  50.     {
  51.         $this->productHideService->onAdminProductCsvExport($event);
  52.     }
  53.     /**
  54.      * @param TemplateEvent $event
  55.      */
  56.     public function onAdminProductProductTwig(TemplateEvent $event)
  57.     {
  58.         $event->addSnippet('@ProductHide42/admin/Product/product.twig');
  59.     }
  60.     /**
  61.      * @param TemplateEvent $event
  62.      */
  63.     public function onAdminProductIndexTwig(TemplateEvent $event)
  64.     {
  65.         $event->addSnippet('@ProductHide42/admin/Product/index.twig');
  66.     }
  67.     /**
  68.      * @param TemplateEvent $event
  69.      */
  70.     public function onProductDetailTwig(TemplateEvent $event)
  71.     {
  72.         $event->addSnippet('@ProductHide42/front/Product/detail.twig');
  73.     }
  74.     /**
  75.      * @param TemplateEvent $event
  76.      */
  77.     public function onCartIndexTwig(TemplateEvent $event)
  78.     {
  79.         $event->addSnippet('@ProductHide42/front/Cart/index.twig');
  80.     }
  81.     /**
  82.      * @param TemplateEvent $event
  83.      */
  84.     public function onMypageHistoryTwig(TemplateEvent $event)
  85.     {
  86.         $event->addSnippet('@ProductHide42/front/Mypage/history.twig');
  87.     }
  88. }