app/Plugin/Blogs42/EventSubscriber/BlogsSubscriber.php line 26

Open in your IDE?
  1. <?php
  2. namespace Plugin\Blogs42\EventSubscriber;
  3. use Symfony\Component\DependencyInjection\ContainerInterface;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Eccube\Event\TemplateEvent;
  6. use Eccube\Event\EventArgs;
  7. use Eccube\Event\EccubeEvents;
  8. class BlogsSubscriber implements EventSubscriberInterface
  9. {
  10.     /**
  11.      * @return array
  12.      */
  13.     public static function getSubscribedEvents()
  14.     {
  15.         return [
  16.             'default_frame.twig' => ['Blogs42'1],
  17.         ];
  18.     }
  19.     /**
  20.      * @param TemplateEvent $event
  21.      */
  22.     public function Blogs42(TemplateEvent $event)
  23.     {
  24.         $Page $event -> getParameter('Page');
  25.         if($Page->getUrl() == 'blogs42_detail'){
  26.             $Blogs $event -> getParameter('Blogs');
  27.             if($Blogs->getAuthor() ){
  28.                 $Page->setAuthor($Blogs->getAuthor());
  29.             }
  30.             if($Blogs->getDescription() ){
  31.                 $Page->setDescription($Blogs->getDescription());
  32.             }
  33.             if($Blogs->getKeyword() ){
  34.                 $Page->setKeyword($Blogs->getKeyword());
  35.             }
  36.             if($Blogs->getMetaRobots() ){
  37.                 $Page->setMetaRobots($Blogs->getMetaRobots());
  38.             }
  39.             if($Blogs->getMetaTags() ){
  40.                 $Page->setMetaTags($Blogs->getMetaTags());
  41.             }
  42.         }
  43.     }
  44. }