<?php
namespace Plugin\Blogs42\EventSubscriber;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Eccube\Event\TemplateEvent;
use Eccube\Event\EventArgs;
use Eccube\Event\EccubeEvents;
class BlogsSubscriber implements EventSubscriberInterface
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'default_frame.twig' => ['Blogs42', 1],
];
}
/**
* @param TemplateEvent $event
*/
public function Blogs42(TemplateEvent $event)
{
$Page = $event -> getParameter('Page');
if($Page->getUrl() == 'blogs42_detail'){
$Blogs = $event -> getParameter('Blogs');
if($Blogs->getAuthor() ){
$Page->setAuthor($Blogs->getAuthor());
}
if($Blogs->getDescription() ){
$Page->setDescription($Blogs->getDescription());
}
if($Blogs->getKeyword() ){
$Page->setKeyword($Blogs->getKeyword());
}
if($Blogs->getMetaRobots() ){
$Page->setMetaRobots($Blogs->getMetaRobots());
}
if($Blogs->getMetaTags() ){
$Page->setMetaTags($Blogs->getMetaTags());
}
}
}
}