<?php/** * Copyright(c) 2019 SYSTEM_KD * Date: 2019/01/26 */namespace Plugin\ScheduleDx\EventSubscriber;use Eccube\Event\TemplateEvent;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\Form\FormView;/** * コンテンツ管理 EventSubscriber * * Class AdminContentEventSubscriber * @package Plugin\ScheduleDx\EventSubscriber */class AdminContentEventSubscriber implements EventSubscriberInterface{ public function __construct() { } /** * ページ管理一覧 テンプレート * * @param TemplateEvent $event */ public function onTemplatePage(TemplateEvent $event) { // 表示追加 $event->addSnippet('@ScheduleDx/admin/Content/page_add.twig'); } /** * ページ管理詳細 テンプレート * * @param TemplateEvent $event */ public function onTemplatePageEdit(TemplateEvent $event) { // JS追加 $event->addSnippet('@ScheduleDx/admin/Common/schedule_support_js.twig'); } /** * ブロック管理一覧 テンプレート * * @param TemplateEvent $event */ public function onTemplateBlock(TemplateEvent $event) { // 表示追加 $event->addSnippet('@ScheduleDx/admin/Content/block_add.twig'); } /** * ブロック管理詳細 テンプレート * * @param TemplateEvent $event */ public function onTemplateBlockEdit(TemplateEvent $event) { // 表示追加 $event->addSnippet('@ScheduleDx/admin/Common/schedule_support_js.twig'); } /** * Returns an array of event names this subscriber wants to listen to. * * The array keys are event names and the value can be: * * * The method name to call (priority defaults to 0) * * An array composed of the method name to call and the priority * * An array of arrays composed of the method names to call and respective * priorities, or 0 if unset * * For instance: * * * array('eventName' => 'methodName') * * array('eventName' => array('methodName', $priority)) * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) * * @return array The event names to listen to */ public static function getSubscribedEvents() { return [ // ページ管理一覧 '@admin/Content/page.twig' => ['onTemplatePage'], // ページ管理詳細 '@admin/Content/page_edit.twig' => ['onTemplatePageEdit'], // ブロック一覧 '@admin/Content/block.twig' => ['onTemplateBlock'], // ブロック詳細 '@admin/Content/block_edit.twig' => ['onTemplateBlockEdit'], ]; }}