<?php
namespace w3des\AdminBundle\Service;
use Symfony\Component\HttpFoundation\RequestStack;
use Twig\Extension\RuntimeExtensionInterface;
class Toolbar implements RuntimeExtensionInterface
{
private $stack;
/**
* @var string
*/
private $editPath = null;
public function __construct(RequestStack $stack)
{
$this->stack = $stack;
}
public function isAdminLogged()
{
$req = $this->stack->getCurrentRequest();
return !$req->attributes->get('_stateless') && $req->hasSession() && $req->getSession()->has('_security_admin_auth');
}
/**
* @return $editPath
*/
public function getEditPath()
{
return $this->editPath;
}
/**
* @param string $editPath
*/
public function setEditPath($editPath)
{
$this->editPath = $editPath;
}
}