mirror of
https://github.com/slawkens/myaac.git
synced 2025-11-21 01:36:24 +01:00
committed by
slawkens
parent
73a5829974
commit
99997eb57d
28
system/src/Twig/EnvironmentBridge.php
Normal file
28
system/src/Twig/EnvironmentBridge.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace MyAAC\Twig;
|
||||
|
||||
use Twig\Environment;
|
||||
|
||||
class EnvironmentBridge extends Environment
|
||||
{
|
||||
public function display($name, array $context = []): void
|
||||
{
|
||||
global $hooks;
|
||||
|
||||
$context['viewName'] = $name;
|
||||
$context = $hooks->triggerFilter(HOOK_FILTER_TWIG_DISPLAY, $context);
|
||||
|
||||
parent::display($name, $context);
|
||||
}
|
||||
|
||||
public function render($name, array $context = []): string
|
||||
{
|
||||
global $hooks;
|
||||
|
||||
$context['viewName'] = $name;
|
||||
$context = $hooks->triggerFilter(HOOK_FILTER_TWIG_RENDER, $context);
|
||||
|
||||
return parent::render($name, $context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user