1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-15 01:24:25 +02:00

Flextype Box Plugin: Admin #125 #117

- Global Vars added
This commit is contained in:
Awilum
2019-06-01 14:59:02 +03:00
parent 753d9ccf2e
commit 90f0db27d7

View File

@@ -0,0 +1,39 @@
<?php
/**
* @package Flextype
*
* @author Sergey Romanenko <hello@romanenko.digital>
* @link http://romanenko.digital
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flextype;
use Flextype\Component\Session\Session;
class GlobalVarsAdminTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
{
/**
* Flextype Dependency Container
*/
private $flextype;
/**
* Constructor
*/
public function __construct($flextype)
{
$this->flextype = $flextype;
}
public function getGlobals()
{
return [
'is_logged' => ((Session::exists('role') && Session::get('role') == 'admin') ? true : false),
'username' => Session::exists('username') ? Session::get('username') : ''
];
}
}