flatten
flatten copied to clipboard
Twig Support
Hi,
I'm working on Twig Support for Flatten and just wanted to make sure first that that feature doesn't already exist and that there isn't some reason why it hasn't been implemented.
Basing off the Blade example in the readme, it would look like this in Twig:
{% cache('articles', 10) %}
{% for article in articles %}
{{ article.name }}
{% endfor %}
{% endcache %}
You're correct it doesn't exist yet, the reason it wasn't implemented is I'm not really familiar with Twig extensions and left it out for now. If you want to PR it I'll gladly merge it :)
Yes, Twig extensions (especially tags) are a little trickier than Blade; it took a couple hours looking through the code to figure it out. I have it more or less working but it's a bit hacked together at the moment so I just need to clean it up and figure out how to write some tests for it.
@dtaub any progress on it? I need that feature too!
@vkbansal I didn't forget about it but I haven't gotten around to cleaning it up and testing it. I do still use Twig regularly, though, so I'll try my best to finish it soon and send a PR, but I can't necessarily make any promises on timing.
@dtaub I can help you out with testing it.