summaryrefslogtreecommitdiff
path: root/src/Renderer/Twig/Extensions/Globals.php
blob: f9bffbc8f07b24adaefb745ab9ced7eba58d98ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace Engelsystem\Renderer\Twig\Extensions;

use Twig_Extension as TwigExtension;
use Twig_Extension_GlobalsInterface as GlobalsInterface;

class Globals extends TwigExtension implements GlobalsInterface
{
    /**
     * Returns a list of global variables to add to the existing list.
     *
     * @return array An array of global variables
     */
    public function getGlobals()
    {
        global $user;

        return [
            'user' => isset($user) ? $user : [],
        ];
    }
}