bundle/w3des/AdminBundle/src/Service/Toolbar.php line 25

Open in your IDE?
  1. <?php
  2. namespace w3des\AdminBundle\Service;
  3. use Symfony\Component\HttpFoundation\RequestStack;
  4. use Twig\Extension\RuntimeExtensionInterface;
  5. class Toolbar implements RuntimeExtensionInterface
  6. {
  7. private $stack;
  8. /**
  9. * @var string
  10. */
  11. private $editPath = null;
  12. public function __construct(RequestStack $stack)
  13. {
  14. $this->stack = $stack;
  15. }
  16. public function isAdminLogged()
  17. {
  18. $req = $this->stack->getCurrentRequest();
  19. return !$req->attributes->get('_stateless') && $req->hasSession() && $req->getSession()->has('_security_admin_auth');
  20. }
  21. /**
  22. * @return $editPath
  23. */
  24. public function getEditPath()
  25. {
  26. return $this->editPath;
  27. }
  28. /**
  29. * @param string $editPath
  30. */
  31. public function setEditPath($editPath)
  32. {
  33. $this->editPath = $editPath;
  34. }
  35. }