<?php
/**
* Created by PhpStorm.
* User: sidux
* Date: 27/12/2015
* Time: 22:17
*/
namespace ArticleCmsBundle\EventListener;
use AWCmsBundle\Event\GlobalTwigVariableEvent;
use AWCmsBundle\Manager\MenuTreeManager;
use AWCmsBundle\Manager\SiteManager;
use AWCmsBundle\Entity\Site;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
/**
* Class LayoutVarSender
*
* @package AppBundle\Event
*/
class TwigVariablesListener implements EventSubscriberInterface
{
private $articleConfig;
public function __construct($articleConfig)
{
$this->articleConfig = $articleConfig;
}
public static function getSubscribedEvents()
{
return [
GlobalTwigVariableEvent::TO_POPULATE_EVENT => 'addData'
];
}
public function addData(GlobalTwigVariableEvent $event)
{
$data['articleConfig'] = $this->articleConfig;
$event->addData($data);
}
}