Craft-User-Manual icon indicating copy to clipboard operation
Craft-User-Manual copied to clipboard

Update to use `registerTwigExtension`

Open braican opened this issue 1 year ago • 3 comments

This PR moves to the registerTwigExtension method to register the Twig extension, as documented in the 4.x docs: https://craftcms.com/docs/4.x/extend/extending-twig.html#register-a-twig-extension. This fixes the Twig instantiated before Craft is fully initialized. warning that the plugin is throwing on each request in Craft 4 installations.

Fixes https://github.com/RobErskine/Craft-User-Manual/issues/32.

How to test

  • Load the plugin with this branch active in a Craft 4 site.
  • Visit an admin page and confirm that the Twig instantiated before Craft is fully initialized. warning doesn't appear in the web logs.
  • Do the same for a frontend page.

braican avatar Oct 07 '22 16:10 braican