Life cycle when processing twig in a page

Can anyone confirm the order in which events are fired when twig is processed in a page? I have a page with the following front mater:

twig_first: true
    twig: true

I then try to access certain data injected by a plugin during the onPageInitialized event. But it’s not available. I know the plugin is working. And a dump() in the plugin itself does indeed return the data, but it doesn’t appear to be available to twig in the page (but it is if requested in a template). So what is the life cycle sequence in this case? Thanks!

onPageInitializedhappens about midway in the lifecycle, so you can actually add your stuff to twig in an event prior like onPagesInitialized or even onTwigInitialized to ensure they are available during page processing.

But the plugin needs to know the route of the page being requested. It does that using $this->grav['page']. Will that return a valid result that early? I guess I’ll just have to try and see :slight_smile: