GlobalVariablesCompilerPass.php 914 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\UserBundle\DependencyInjection\Compiler;
  11. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Symfony\Component\DependencyInjection\Reference;
  14. /**
  15. * GlobalVariablesCompilerPass
  16. *
  17. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  18. */
  19. class GlobalVariablesCompilerPass implements CompilerPassInterface
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. function process(ContainerBuilder $container)
  25. {
  26. $container->getDefinition('twig')
  27. ->addMethodCall('addGlobal', array('sonata_user', new Reference('sonata.user.twig.global')));
  28. }
  29. }