app/Plugin/RelatedProduct4/RelatedProductEvent.php line 50

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.  * http://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\RelatedProduct4;
  13. use Eccube\Event\TemplateEvent;
  14. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15. class RelatedProductEvent implements EventSubscriberInterface
  16. {
  17.     public static function getSubscribedEvents()
  18.     {
  19.         return [
  20.             '@admin/Product/product.twig' => 'onRenderAdminProduct',
  21.             'Product/detail.twig' => 'onRenderProductDetail',
  22.             'Product/detail_slug.twig' => 'onRenderProductDetailSlug'   //追加
  23.         ];
  24.     }
  25.     /**
  26.      * フロント:商品詳細画面に関連商品を表示する.
  27.      *
  28.      * @param TemplateEvent $event
  29.      */
  30.     public function onRenderProductDetail(TemplateEvent $event)
  31.     {
  32.         $event->addSnippet('@RelatedProduct4/front/related_product.twig');
  33.     }
  34.     public function onRenderProductDetailSlug(TemplateEvent $event)
  35.     {
  36.         $event->addSnippet('@RelatedProduct4/front/related_product.twig');
  37.     }
  38.     /**
  39.      * 管理画面:商品登録画面に関連商品登録フォームを表示する.
  40.      *
  41.      * @param TemplateEvent $event
  42.      */
  43.     public function onRenderAdminProduct(TemplateEvent $event)
  44.     {
  45.         $event->addSnippet('@RelatedProduct4/admin/related_product.twig');
  46.     }
  47. }