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

Update to use registerTwigExtension #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

braican
Copy link

@braican braican commented Oct 7, 2022

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 #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.

@RobErskine
Copy link
Owner

Thanks @braican! Will try to take a look over the next few days to get this merged in.

@arnedem
Copy link

arnedem commented Feb 15, 2023

@RobErskine Any progress on this? This change also fixes an issue when applying existing project config settings on a fresh install: can't apply existing project config: Unable to register extension "roberskine\usermanual\twigextensions\UserManualTwigExtension" as it is already registered.

@mike-moreau
Copy link

mike-moreau commented Feb 23, 2024

@RobErskine would be nice to see this merged in

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

Successfully merging this pull request may close these issues.

Plugin causes "Twig instantiated before Craft is fully initialized" warning
4 participants