StatusRendererCompilerPass.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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\CoreBundle\DependencyInjection\Compiler;
  11. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Symfony\Component\DependencyInjection\Reference;
  14. /**
  15. * @author Hugo Briand <briand@ekino.com>
  16. */
  17. class StatusRendererCompilerPass implements CompilerPassInterface
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function process(ContainerBuilder $container)
  23. {
  24. foreach ($container->findTaggedServiceIds('sonata.status.renderer') as $id => $attributes) {
  25. $container
  26. ->getDefinition('sonata.core.twig.status_extension')
  27. ->addMethodCall('addStatusService', array(new Reference($id)))
  28. ;
  29. }
  30. }
  31. }