Bolt\Twig\TwigExtension::getFunctions PHP Method

getFunctions() public method

public getFunctions ( )
    public function getFunctions()
    {
        $safe = ['is_safe' => ['html']];
        $env = ['needs_environment' => true];
        $deprecated = ['deprecated' => true];
        return [new \Twig_SimpleFunction('__', [$this, 'trans'], $safe), new \Twig_SimpleFunction('backtrace', [$this, 'printBacktrace']), new \Twig_SimpleFunction('buid', [$this, 'buid'], $safe), new \Twig_SimpleFunction('canonical', [$this, 'canonical']), new \Twig_SimpleFunction('countwidgets', [$this, 'countWidgets'], $safe), new \Twig_SimpleFunction('current', [$this, 'current']), new \Twig_SimpleFunction('data', [$this, 'addData']), new \Twig_SimpleFunction('dump', [$this, 'printDump']), new \Twig_SimpleFunction('excerpt', [$this, 'excerpt'], $safe), new \Twig_SimpleFunction('fields', [$this, 'fields'], $env + $safe), new \Twig_SimpleFunction('file_exists', [$this, 'fileExists'], $deprecated), new \Twig_SimpleFunction('firebug', [$this, 'printFirebug']), new \Twig_SimpleFunction('getuser', [$this, 'getUser']), new \Twig_SimpleFunction('getuserid', [$this, 'getUserId']), new \Twig_SimpleFunction('getwidgets', [$this, 'getWidgets'], $safe), new \Twig_SimpleFunction('haswidgets', [$this, 'hasWidgets'], $safe), new \Twig_SimpleFunction('hattr', [$this, 'hattr'], $safe), new \Twig_SimpleFunction('hclass', [$this, 'hclass'], $safe), new \Twig_SimpleFunction('htmllang', [$this, 'htmlLang']), new \Twig_SimpleFunction('image', [$this, 'image']), new \Twig_SimpleFunction('imageinfo', [$this, 'imageInfo']), new \Twig_SimpleFunction('isallowed', [$this, 'isAllowed']), new \Twig_SimpleFunction('ismobileclient', [$this, 'isMobileClient']), new \Twig_SimpleFunction('link', [$this, 'link'], $safe), new \Twig_SimpleFunction('listtemplates', [$this, 'listTemplates']), new \Twig_SimpleFunction('markdown', [$this, 'markdown'], $safe), new \Twig_SimpleFunction('menu', [$this, 'menu'], $env + $safe), new \Twig_SimpleFunction('pager', [$this, 'pager'], $env), new \Twig_SimpleFunction('popup', [$this, 'popup'], $safe), new \Twig_SimpleFunction('randomquote', [$this, 'randomQuote'], $safe), new \Twig_SimpleFunction('redirect', [$this, 'redirect'], $safe), new \Twig_SimpleFunction('request', [$this, 'request']), new \Twig_SimpleFunction('showimage', [$this, 'showImage'], $safe), new \Twig_SimpleFunction('stack', [$this, 'stack']), new \Twig_SimpleFunction('thumbnail', [$this, 'thumbnail']), new \Twig_SimpleFunction('token', [$this, 'token'], $deprecated + ['alternative' => 'csrf_token']), new \Twig_SimpleFunction('unique', [$this, 'unique'], $safe), new \Twig_SimpleFunction('widgets', [$this, 'widgets'], $safe)];
    }

Usage Example

Example #1
0
 public function testTwigInterface()
 {
     $app = $this->getApp();
     $handlers = $this->getTwigHandlers($app);
     $twig = new TwigExtension($app, $handlers, false);
     $this->assertGreaterThan(0, $twig->getFunctions());
     $this->assertGreaterThan(0, $twig->getFilters());
     $this->assertGreaterThan(0, $twig->getTests());
     $this->assertEquals('Bolt', $twig->getName());
 }