<?php
/**
* Copyright(c) 2019 SYSTEM_KD
* Date: 2019/07/12
*/
namespace Plugin\PointEx\EventSubscriber;
use Eccube\Event\TemplateEvent;
use Plugin\PointEx\Service\TwigRenderService\TwigRenderService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AdminShopEventSubscriber implements EventSubscriberInterface
{
protected $twigRenderService;
public function __construct(
TwigRenderService $twigRenderService
)
{
$this->twigRenderService = $twigRenderService;
}
/**
* 店舗設定
*
* @param TemplateEvent $event
*/
public function onTemplateShopMaster(TemplateEvent $event)
{
$this->twigRenderService->initRenderService($event);
$this->twigRenderService
->insertBuilder()
->find('#ex-shop-point')
->setTargetId('point_ex_shop_setting')
->setInsertModeReplaceWith();
$this->twigRenderService->addSupportSnippet(
'@PointEx/admin/Setting/Shop/shop_master_replace.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:
*
* * ['eventName' => 'methodName']
* * ['eventName' => ['methodName', $priority]]
* * ['eventName' => [['methodName1', $priority], ['methodName2']]]
*
* @return array The event names to listen to
*/
public static function getSubscribedEvents()
{
return [
'@admin/Setting/Shop/shop_master.twig' => ['onTemplateShopMaster']
];
}
}