mirror of
https://github.com/flextype/flextype.git
synced 2025-08-15 01:24:25 +02:00
39
site/plugins/admin/twig/GlobalVarsAdminTwigExtension.php
Normal file
39
site/plugins/admin/twig/GlobalVarsAdminTwigExtension.php
Normal 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') : ''
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user