Skip to content

Commit

Permalink
Use registerTwigExtension()
Browse files Browse the repository at this point in the history
Fixes a bug where the plugin may cause Twig to be loaded before it should be, and another bug where the extension might not be available if the Template Mode ever changes from CP to Site, or vise-versa.
  • Loading branch information
brandonkelly authored Jul 20, 2018
1 parent 42a2696 commit d44fa8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TimeAgo.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function init()
self::$plugin = $this;

// Add in our Twig extensions
Craft::$app->view->twig->addExtension(new twigextensions\TimeAgoTwigExtension());
Craft::$app->view->registerTwigExtension(new twigextensions\TimeAgoTwigExtension());

Craft::info(
Craft::t(
Expand Down

0 comments on commit d44fa8a

Please sign in to comment.