app/Plugin/Schedule/EventSubscriber/ShoppingEventSubscriber.php line 16

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright(c) 2022 SYSTEM_KD
  4.  * Date: 2022/04/20
  5.  */
  6. namespace Plugin\Schedule\EventSubscriber;
  7. use Eccube\Event\TemplateEvent;
  8. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  9. class ShoppingEventSubscriber implements EventSubscriberInterface
  10. {
  11.     public function onTemplateShopping(TemplateEvent $event)
  12.     {
  13.         // 表示追加
  14.         $event->addSnippet('@Schedule/default/Shopping/index_add.twig');
  15.     }
  16.     /**
  17.      * Returns an array of event names this subscriber wants to listen to.
  18.      *
  19.      * The array keys are event names and the value can be:
  20.      *
  21.      *  * The method name to call (priority defaults to 0)
  22.      *  * An array composed of the method name to call and the priority
  23.      *  * An array of arrays composed of the method names to call and respective
  24.      *    priorities, or 0 if unset
  25.      *
  26.      * For instance:
  27.      *
  28.      *  * ['eventName' => 'methodName']
  29.      *  * ['eventName' => ['methodName', $priority]]
  30.      *  * ['eventName' => [['methodName1', $priority], ['methodName2']]]
  31.      *
  32.      * The code must not depend on runtime state as it will only be called at compile time.
  33.      * All logic depending on runtime state must be put into the individual methods handling the events.
  34.      *
  35.      * @return array<string, mixed> The event names to listen to
  36.      */
  37.     public static function getSubscribedEvents()
  38.     {
  39.         return [
  40.             'Shopping/index.twig' => ['onTemplateShopping'],
  41.             'Shopping/confirm.twig' => ['onTemplateShopping'],
  42.         ];
  43.     }
  44. }