<?php
namespace Plugin\CMBlogPro42;
use Eccube\Event\TemplateEvent;
use Plugin\CMBlogPro42\Repository\BlogRepository;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class Event implements EventSubscriberInterface
{
/**
* @var BlogRepository
*/
protected $blogRepository;
public function __construct(BlogRepository $blogRepository = null) {
$this->blogRepository = $blogRepository;
}
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'Block/new_topic.twig' => 'onTopic'
];
}
public function onTopic(TemplateEvent $event)
{
$Blogs = $this->blogRepository->getBlockList();
$event->setParameter('Blogs', $Blogs);
}
}