vendor/simpledot/cms-bundle/AWCmsBundle/Twig/Extension/GlobalVariablesExtension.php line 12

Open in your IDE?
  1. <?php
  2. namespace AWCmsBundle\Twig\Extension;
  3. use AWCmsBundle\Event\GlobalTwigVariableEvent;
  4. use Symfony\Component\EventDispatcher\EventDispatcher;
  5. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  6. use Twig_Extension;
  7. use Twig_Extension_GlobalsInterface;
  8. class GlobalVariablesExtension extends Twig_Extension implements Twig_Extension_GlobalsInterface
  9. {
  10.     private $eventDispatcher;
  11.     
  12.     public function __construct(EventDispatcherInterface $eventDispatcher)
  13.     {
  14.         $this->eventDispatcher $eventDispatcher;
  15.     }
  16.     public function getGlobals()
  17.     {
  18.         $event = new GlobalTwigVariableEvent();
  19.         $this->eventDispatcher->dispatch(GlobalTwigVariableEvent::TO_POPULATE_EVENT$event);
  20.         return $event->getData();
  21.     }
  22. }