Update plugin to add twig functions in the way Timber 2 expects#11
Update plugin to add twig functions in the way Timber 2 expects#11
Conversation
|
@akoziolsc FYI I added you as a reviewer for this PR for now because I can't add Ryan yet (apparently he's not part of our organization yet). If you have time to review, great. If not, I'll switch it to Ryan once he's part of our organization. |
gearlab-tools.php
Outdated
| )); | ||
|
|
||
| return $twig; | ||
| add_filter('timber/twig/functions', function ($functions) { |
There was a problem hiding this comment.
@sdunham I think, you could use timber/twig filter instead and make it compatible across the board: https://timber.github.io/docs/v2/hooks/filters/#timber/twig
This would require us to check to make sure proper Twig related classes exist but it should be doable. This would be one way to ensure it will not cause issues with other older projects. Not requirement but suggestion.
There was a problem hiding this comment.
Great suggestion, I went ahead and implemented it. I still want to make sure any sites still using this plugin specify a version instead of a branch, and work on migrating those sites to the Sitka plugin at some point in the future, but this will provide maximum backward-compatibility. Thanks!
PR title is pretty self-explanatory, but this plugin isn't compatible with Timber 2. It adds a custom Twig function in the way Timber 1 expects. This update migrates to adding this function in the way Timber 2 expects.
A couple of notes:
dev-master. As far as I can tell, that's only the AWB site (which sparked this update since it's being update to Timber 2) and Metro Parks. I've opened a PR to update MP's ompiser file to explicitly use v1.0 of the plugin.