app/Plugin/StripePayment43/StripePaymentEvent.php line 74

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * https://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Plugin\StripePayment43;
  13. use Eccube\Event\TemplateEvent;
  14. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15. class StripePaymentEvent implements EventSubscriberInterface
  16. {
  17.     /**
  18.      * リッスンしたいサブスクライバのイベント名の配列を返します。
  19.      * 配列のキーはイベント名、値は以下のどれかをしてします。
  20.      * - 呼び出すメソッド名
  21.      * - 呼び出すメソッド名と優先度の配列
  22.      * - 呼び出すメソッド名と優先度の配列の配列
  23.      * 優先度を省略した場合は0
  24.      *
  25.      * 例:
  26.      * - array('eventName' => 'methodName')
  27.      * - array('eventName' => array('methodName', $priority))
  28.      * - array('eventName' => array(array('methodName1', $priority), array('methodName2')))
  29.      *
  30.      * {@inheritdoc}
  31.      */
  32.     public static function getSubscribedEvents()
  33.     {
  34.         return [
  35.             'Shopping/index.twig' => 'onShoppingIndexTwig',
  36.             'Shopping/confirm.twig' => 'onShoppingConfirmTwig',
  37.             '@admin/Order/index.twig' => 'onAdminOrderTwig',
  38.             '@admin/Order/edit.twig' => 'onAdminOrderEditTwig',
  39.             '@admin/Customer/edit.twig' => 'onAdminCustomerEditTwig',
  40.             'Mypage/navi.twig' => 'onMypageNaviTwig',
  41.             'Mypage/history.twig' => 'onMypageHistoryTwig',
  42.         ];
  43.     }
  44.     public function onShoppingIndexTwig(TemplateEvent $event)
  45.     {
  46.         $event->addSnippet('@StripePayment43/stripe_payment.twig');
  47.     }
  48.     public function onShoppingConfirmTwig(TemplateEvent $event)
  49.     {
  50.         $event->addSnippet('@StripePayment43/stripe_payment_confirm.twig');
  51.     }
  52.     public function onMypageHistoryTwig(TemplateEvent $event)
  53.     {
  54.         $event->addSnippet('@StripePayment43/stripe_mypage_history.twig');
  55.     }
  56.     public function onAdminOrderTwig(TemplateEvent $event)
  57.     {
  58.         $event->addSnippet('@StripePayment43/admin/order_index.twig');
  59.     }
  60.     public function onAdminOrderEditTwig(TemplateEvent $event)
  61.     {
  62.         $event->addSnippet('@StripePayment43/admin/order_edit.twig');
  63.     }
  64.     public function onAdminCustomerEditTwig(TemplateEvent $event)
  65.     {
  66.         $event->addSnippet('@StripePayment43/admin/customer_edit.twig');
  67.     }
  68.     public function onMypageNaviTwig(TemplateEvent $event)
  69.     {
  70.         $source $event->getSource();
  71.         $source .= file_get_contents(__DIR__.'/Resource/template/navi.twig');
  72.         $event->setSource($source);
  73.     }
  74. }