app/Plugin/Schedule/EventSubscriber/AdminContentEventSubscriber.php line 33

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright(c) 2019 SYSTEM_KD
  4.  * Date: 2019/01/26
  5.  */
  6. namespace Plugin\Schedule\EventSubscriber;
  7. use Eccube\Event\TemplateEvent;
  8. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  9. use Symfony\Component\Form\FormView;
  10. /**
  11.  * コンテンツ管理 EventSubscriber
  12.  *
  13.  * Class AdminContentEventSubscriber
  14.  * @package Plugin\Schedule\EventSubscriber
  15.  */
  16. class AdminContentEventSubscriber implements EventSubscriberInterface
  17. {
  18.     public function __construct()
  19.     {
  20.     }
  21.     /**
  22.      * ページ管理一覧 テンプレート
  23.      *
  24.      * @param TemplateEvent $event
  25.      */
  26.     public function onTemplatePage(TemplateEvent $event)
  27.     {
  28.         // 表示追加
  29.         $event->addSnippet('@Schedule/admin/Content/page_add.twig');
  30.     }
  31.     /**
  32.      * ページ管理詳細 テンプレート
  33.      *
  34.      * @param TemplateEvent $event
  35.      */
  36.     public function onTemplatePageEdit(TemplateEvent $event)
  37.     {
  38.         // JS追加
  39.         $event->addSnippet('@Schedule/admin/Common/schedule_support_js.twig');
  40.     }
  41.     /**
  42.      * ブロック管理一覧 テンプレート
  43.      *
  44.      * @param TemplateEvent $event
  45.      */
  46.     public function onTemplateBlock(TemplateEvent $event)
  47.     {
  48.         // 表示追加
  49.         $event->addSnippet('@Schedule/admin/Content/block_add.twig');
  50.     }
  51.     /**
  52.      * ブロック管理詳細 テンプレート
  53.      *
  54.      * @param TemplateEvent $event
  55.      */
  56.     public function onTemplateBlockEdit(TemplateEvent $event)
  57.     {
  58.         // 表示追加
  59.         $event->addSnippet('@Schedule/admin/Common/schedule_support_js.twig');
  60.     }
  61.     /**
  62.      * Returns an array of event names this subscriber wants to listen to.
  63.      *
  64.      * The array keys are event names and the value can be:
  65.      *
  66.      *  * The method name to call (priority defaults to 0)
  67.      *  * An array composed of the method name to call and the priority
  68.      *  * An array of arrays composed of the method names to call and respective
  69.      *    priorities, or 0 if unset
  70.      *
  71.      * For instance:
  72.      *
  73.      *  * array('eventName' => 'methodName')
  74.      *  * array('eventName' => array('methodName', $priority))
  75.      *  * array('eventName' => array(array('methodName1', $priority), array('methodName2')))
  76.      *
  77.      * @return array The event names to listen to
  78.      */
  79.     public static function getSubscribedEvents()
  80.     {
  81.         return [
  82.             // ページ管理一覧
  83.             '@admin/Content/page.twig' => ['onTemplatePage'],
  84.             // ページ管理詳細
  85.             '@admin/Content/page_edit.twig' => ['onTemplatePageEdit'],
  86.             // ブロック一覧
  87.             '@admin/Content/block.twig' => ['onTemplateBlock'],
  88.             // ブロック詳細
  89.             '@admin/Content/block_edit.twig' => ['onTemplateBlockEdit'],
  90.         ];
  91.     }
  92. }