Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

TiGR
Copy link

@TiGR TiGR commented Sep 19, 2014

This allows, for instance, producing more readable output. See issue #1005.

* @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)
Copy link
Member

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+

@TiGR
Copy link
Author

TiGR commented Sep 25, 2014

I see that build failed, but I was not able to spot any error messages related to my code. Build failed in unrelated code.

@hacfi
Copy link

hacfi commented Sep 27, 2014

👍 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.
@TiGR
Copy link
Author

TiGR commented Oct 11, 2014

Okay, finally was able to fix it, after shippable erroneus builds were removed.

@hacfi
Copy link

hacfi commented Oct 11, 2014

What do you think about it @fabpot ?

@fabpot
Copy link
Contributor

fabpot commented Oct 11, 2014

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.

@fabpot fabpot closed this Oct 11, 2014
@MattiJarvinen-BA
Copy link

Any ideas after 2 years?

@TiGR
Copy link
Author

TiGR commented Jan 9, 2017

Okay, I've created composer package for anyone to use. Should I add ready to use preformatter aslo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants