-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Preprocessor Loader that allows pre-filtering template code. #1508
Conversation
* @param Twig_LoaderInterface $loader A loader that does real loading of templates | ||
* @param callable $callback The processing callback | ||
*/ | ||
public function __construct(Twig_LoaderInterface $loader, callable $callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the callable typehint must be removed as it requires PHP 5.4+
I see that build failed, but I was not able to spot any error messages related to my code. Build failed in unrelated code. |
👍 love it |
This allows, for instance, producing more readable output. See issue twigphp#1005.
Fixed PHP 5.2 compatibility, code style and proper handling of Twig_ExistsLoaderInterface loaders.
Okay, finally was able to fix it, after shippable erroneus builds were removed. |
What do you think about it @fabpot ? |
So, I've been thinking about this one for quite a long time and I'm not comfortable having this in Twig itself. First, there is not change in Twig itself meaning that it can be packaged outside of Twig quite easily. Then, the whole concept seems quite hackish and fragile to me, so I don't want to endorse this way of doing things. I'm closing the PR but I keep the issue open as we might find a way to better fix it. @TiGR Thanks for your work. |
Any ideas after 2 years? |
Okay, I've created composer package for anyone to use. Should I add ready to use preformatter aslo? |
This allows, for instance, producing more readable output. See issue #1005.