app/Plugin/CategoryImagePlugin42/Event.php line 27

Open in your IDE?
  1. <?php
  2. namespace Plugin\CategoryImagePlugin42;
  3. use Eccube\Event\EventArgs;
  4. use Eccube\Event\TemplateEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class Event implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * @return array
  10.      */
  11.     public static function getSubscribedEvents()
  12.     {
  13.         return [
  14.             '@admin/Product/category.twig' => 'onRenderAdminProductCategory',
  15.             'Product/list.twig' => 'onRenderProductList',
  16.         ];
  17.     }
  18.     /**
  19.      * 管理画面カテゴリ登録に画像ボタンを表示する.
  20.      *
  21.      * @param TemplateEvent $event
  22.      */
  23.     public function onRenderAdminProductCategory(TemplateEvent $event)
  24.     {
  25.         $event->addSnippet('@CategoryImagePlugin42/admin/Product/category.twig');
  26.     }
  27.     /**
  28.      * 商品一覧にカテゴリバナーを表示する.
  29.      *
  30.      * @param TemplateEvent $event
  31.      */
  32.     public function onRenderProductList(TemplateEvent $event)
  33.     {
  34.         $event->addSnippet('@CategoryImagePlugin42/default/Product/list.twig');
  35.     }
  36. }