app/Plugin/PointEx/EventSubscriber/AdminShopEventSubscriber.php line 31

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright(c) 2019 SYSTEM_KD
  4.  * Date: 2019/07/12
  5.  */
  6. namespace Plugin\PointEx\EventSubscriber;
  7. use Eccube\Event\TemplateEvent;
  8. use Plugin\PointEx\Service\TwigRenderService\TwigRenderService;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. class AdminShopEventSubscriber implements EventSubscriberInterface
  11. {
  12.     protected $twigRenderService;
  13.     public function __construct(
  14.         TwigRenderService $twigRenderService
  15.     )
  16.     {
  17.         $this->twigRenderService $twigRenderService;
  18.     }
  19.     /**
  20.      * 店舗設定
  21.      *
  22.      * @param TemplateEvent $event
  23.      */
  24.     public function onTemplateShopMaster(TemplateEvent $event)
  25.     {
  26.         $this->twigRenderService->initRenderService($event);
  27.         $this->twigRenderService
  28.             ->insertBuilder()
  29.             ->find('#ex-shop-point')
  30.             ->setTargetId('point_ex_shop_setting')
  31.             ->setInsertModeReplaceWith();
  32.         $this->twigRenderService->addSupportSnippet(
  33.             '@PointEx/admin/Setting/Shop/shop_master_replace.twig'
  34.         );
  35.     }
  36.     /**
  37.      * Returns an array of event names this subscriber wants to listen to.
  38.      *
  39.      * The array keys are event names and the value can be:
  40.      *
  41.      *  * The method name to call (priority defaults to 0)
  42.      *  * An array composed of the method name to call and the priority
  43.      *  * An array of arrays composed of the method names to call and respective
  44.      *    priorities, or 0 if unset
  45.      *
  46.      * For instance:
  47.      *
  48.      *  * ['eventName' => 'methodName']
  49.      *  * ['eventName' => ['methodName', $priority]]
  50.      *  * ['eventName' => [['methodName1', $priority], ['methodName2']]]
  51.      *
  52.      * @return array The event names to listen to
  53.      */
  54.     public static function getSubscribedEvents()
  55.     {
  56.         return [
  57.             '@admin/Setting/Shop/shop_master.twig' => ['onTemplateShopMaster']
  58.         ];
  59.     }
  60. }