Twig Editor does not respect Twig Extensions
2 posts
• Page 1 of 1
Twig Editor does not respect Twig Extensions
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?
- EraYaN
- Posts: 9
- Joined: June 5th, 2014, 11:06 am
Re: Twig Editor does not respect Twig Extensions
Hi EraYaN,
thank you for your feedback.
The extension functions from Slim are defined in a composer package, which is not currently analyzed by Twig.
We will add the analysis in the next update.
Symfony extensions for Twig are not yet supported.
We will add the support in the future, but we
Best regards,
Michal
thank you for your feedback.
The extension functions from Slim are defined in a composer package, which is not currently analyzed by Twig.
We will add the analysis in the next update.
Symfony extensions for Twig are not yet supported.
We will add the support in the future, but we
Best regards,
Michal
Michal Brabec │ DEVSENSE s.r.o. │ @gMichalBrabec │ michal.brabec@devsense.com
-
Michal Brabec - Posts: 13
- Joined: September 14th, 2016, 8:55 am
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 53 guests