From fcbfc2eede7f3b41255e37aaf392ad3891aafcb7 Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 31 May 2019 00:29:07 +0300 Subject: [PATCH] Slim Framework integration #118 #117 - GlobalVars: is_logged added --- flextype/twig/GlobalVarsTwigExtension.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flextype/twig/GlobalVarsTwigExtension.php b/flextype/twig/GlobalVarsTwigExtension.php index 83f8ccf8..4ede5268 100644 --- a/flextype/twig/GlobalVarsTwigExtension.php +++ b/flextype/twig/GlobalVarsTwigExtension.php @@ -12,6 +12,8 @@ namespace Flextype; +use Flextype\Component\Session\Session; + class GlobalVarsTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface { /** @@ -39,7 +41,8 @@ class GlobalVarsTwigExtension extends \Twig_Extension implements \Twig_Extension 'PATH_CONFIG_SITE' => PATH['config']['site'], 'PATH_CACHE' => PATH['cache'], 'flextype_version' => FLEXTYPE_VERSION, - 'registry' => $this->flextype['registry']->dump() + 'registry' => $this->flextype['registry']->dump(), + 'is_logged' => ((Session::exists('role') && Session::get('role') == 'admin') ? true : false) ]; } }