GlobalVariables.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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\UserBundle\Twig;
  11. use Sonata\AdminBundle\Admin\AdminInterface;
  12. use Symfony\Component\DependencyInjection\ContainerInterface;
  13. /**
  14. * GlobalVariables.
  15. *
  16. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  17. */
  18. class GlobalVariables
  19. {
  20. protected $container;
  21. /**
  22. * @param ContainerInterface $container
  23. */
  24. public function __construct(ContainerInterface $container)
  25. {
  26. $this->container = $container;
  27. }
  28. /**
  29. * @return string
  30. */
  31. public function getImpersonating()
  32. {
  33. return $this->container->getParameter('sonata.user.impersonating');
  34. }
  35. /**
  36. * @return string
  37. */
  38. public function getDefaultAvatar()
  39. {
  40. return $this->container->getParameter('sonata.user.default_avatar');
  41. }
  42. /**
  43. * @return AdminInterface
  44. */
  45. public function getUserAdmin()
  46. {
  47. return $this->container->get('sonata.user.admin.user');
  48. }
  49. }