1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 08:04:05 +02:00

Flextype Core: Emitter Twig Extension - added

This commit is contained in:
Awilum
2019-03-01 18:58:43 +03:00
parent a0cb8d4375
commit 7726535de5

View File

@@ -0,0 +1,32 @@
<?php
namespace Flextype;
class EmitterTwigExtension extends \Twig_Extension
{
/**
* Flextype Dependency Container
*/
private $flextype;
/**
* __construct
*/
public function __construct($flextype)
{
$this->flextype = $flextype;
}
public function getFunctions()
{
return [
new \Twig_SimpleFunction('emmiter_emmit', array($this, 'emit')),
];
}
public function emit(string $event)
{
return $this->flextype['emitter']->emit($event);
}
}