vendor/simpledot/article-bundle/ArticleCmsBundle/EventListener/TwigVariablesListener.php line 42

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: sidux
  5.  * Date: 27/12/2015
  6.  * Time: 22:17
  7.  */
  8. namespace ArticleCmsBundle\EventListener;
  9. use AWCmsBundle\Event\GlobalTwigVariableEvent;
  10. use AWCmsBundle\Manager\MenuTreeManager;
  11. use AWCmsBundle\Manager\SiteManager;
  12. use AWCmsBundle\Entity\Site;
  13. use Symfony\Component\DependencyInjection\ContainerInterface;
  14. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15. use Symfony\Component\HttpKernel\Event\GetResponseEvent;
  16. use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
  17. /**
  18.  * Class LayoutVarSender
  19.  *
  20.  * @package AppBundle\Event
  21.  */
  22. class TwigVariablesListener implements EventSubscriberInterface
  23. {
  24.     private $articleConfig;
  25.     
  26.     public function __construct($articleConfig)
  27.     {
  28.         $this->articleConfig $articleConfig;
  29.     }
  30.     
  31.     
  32.     public static function getSubscribedEvents()
  33.     {
  34.         return [
  35.             GlobalTwigVariableEvent::TO_POPULATE_EVENT => 'addData'
  36.         ];    
  37.     }
  38.     public function addData(GlobalTwigVariableEvent $event)
  39.     {
  40.         $data['articleConfig'] = $this->articleConfig;
  41.         $event->addData($data);
  42.     }
  43. }