1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-15 09:34:14 +02:00

Flextype Core: Global Vars Twig Extension - added

This commit is contained in:
Awilum
2019-03-20 10:59:56 +03:00
parent 8827b0bcd6
commit de4c761e88
2 changed files with 40 additions and 0 deletions

View File

@@ -300,6 +300,9 @@ $flextype['view'] = function ($container) {
// Add Csrf Twig Extension
$view->addExtension(new CsrfTwigExtension($container->get('csrf')));
// Add Global Vars Twig Extension
$view->addExtension(new GlobalVarsTwigExtension($container));
// Return view
return $view;
};

View File

@@ -0,0 +1,37 @@
<?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;
class GlobalVarsTwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
{
/**
* Flextype Dependency Container
*/
private $flextype;
/**
* Constructor
*/
public function __construct($flextype)
{
$this->flextype = $flextype;
}
public function getGlobals()
{
return [
'flextype_version' => '0.9.0',
'registry' => $this->flextype['registry']->dump()
];
}
}