Open damienalexandre opened 6 years ago
What's the drawback of the first solution (marking the return of the twig function as always safe)?
The main drawback is compatibility with Symfony native translation system. If we go "always safe", there will be no escaping on translations, ever. But we only want to disable escaping when we are in the "Edit" mode.
https://github.com/php-translation/symfony-bundle/pull/102 introduce the
is_safe_callback
option instead of the oldis_safe => ['html']
that was causing some issues and unexpected behavior (changing the way Symfony does the escaping by default).But there is an issue with this method as Twig use this method during the compile phase. So the generated templates never call the callback again.
So on a fresh and empty cache:
Enabling and disabling the Edit In Place (via the Activator service) does not re-compile Twig cache.
There is two issues:
Some possible solutions: