Twig Editor does not respect Twig Extensions
Posted: May 5th, 2018, 5:25 am
I setup my Twig like this currently. (Using Slim v3)
Now the SimpleFunctions provided by \Slim\Views\TwigExtension all get red squiqqly lines and the SplitView doesn't work at all.
It is a custom fork of the Twig-View componenet: https://github.com/EraYaN/Twig-View/blo ... ension.php the getFunctions function is correctly implemented.
And the second thing is the 'trans' tag only works in full tag format. Not in the
Is there any way to make this work?
- Code: Select all
$container['view'] = function ($c) {
$view = new \Slim\Views\Twig('twig-templates', [
'cache' => $c['settings']['caching'],
'debug' => $c['settings']['debug']
]);
// Instantiate and add Slim specific extension
$view->addExtension(new \Slim\Views\TwigExtension($c['router'], $c['request']->getUri()));
$view->addExtension(new Twig_Extensions_Extension_I18n());
if($c['settings']['debug'])
$view->addExtension(new Twig_Extension_Debug());
$view->addExtension(new SlugifyExtension(Slugify::create()));
$twig_env = $view->getEnvironment();
$twig_env->addGlobal('session', $_SESSION);
global $cfg;
$twig_env->addGlobal('cfg', $cfg);
global $data;
$twig_env->addGlobal('data', $data);
return $view;
};
Now the SimpleFunctions provided by \Slim\Views\TwigExtension all get red squiqqly lines and the SplitView doesn't work at all.
It is a custom fork of the Twig-View componenet: https://github.com/EraYaN/Twig-View/blo ... ension.php the getFunctions function is correctly implemented.
And the second thing is the 'trans' tag only works in full tag format. Not in the
- Code: Select all
{% trans 'Word' %}
Is there any way to make this work?