GlobalVariablesCompilerPass.php 899 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project 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. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  16. */
  17. class GlobalVariablesCompilerPass implements CompilerPassInterface
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function process(ContainerBuilder $container)
  23. {
  24. $container->getDefinition('twig')
  25. ->addMethodCall('addGlobal', array('sonata_admin', new Reference('sonata.admin.twig.global')));
  26. }
  27. }