1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-31 03:10:19 +02:00

Version 1.1.0 Introducing Plugins, Event-Dispatcher and CookieConsent

This commit is contained in:
Sebastian
2018-02-06 19:19:02 +01:00
parent 5fa14fb838
commit cb9bfdc0c5
87 changed files with 4432 additions and 491 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace Typemill\Extensions;
use Slim\Csrf\Guard;
class TwigCsrfExtension extends \Twig_Extension
{
protected $guard;
public function __construct(Guard $guard)
{
$this->guard = $guard;
}
public function getFunctions()
{
return [
new \Twig_SimpleFunction('csrf_field', array($this, 'csrfField' ))
];
}
public function csrfField()
{
return '
<input type="hidden" id="' . $this->guard->getTokenNameKey() . '" name="' . $this->guard->getTokenNameKey() . '" value="' . $this->guard->getTokenName() . '">
<input type="hidden" id="' . $this->guard->getTokenValueKey() . '" name="' . $this->guard->getTokenValueKey() . '" value="' . $this->guard->getTokenValue() . '">
';
}
}