GlobalVariablesCompilerPass.php 991 B

123456789101112131415161718192021222324252627282930313233
  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\AdminBundle\DependencyInjection\Compiler;
  11. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Symfony\Component\DependencyInjection\Reference;
  14. /**
  15. * Class GlobalVariablesCompilerPass
  16. *
  17. * @package Sonata\AdminBundle\DependencyInjection\Compiler
  18. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  19. */
  20. class GlobalVariablesCompilerPass implements CompilerPassInterface
  21. {
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function process(ContainerBuilder $container)
  26. {
  27. $container->getDefinition('twig')
  28. ->addMethodCall('addGlobal', array('sonata_admin', new Reference('sonata.admin.twig.global')));
  29. }
  30. }