As a test I then changed it to the following, this did not work - and I believe should not because $my_var is not defined. But this did not raise an exception either or produced any other errors.
$grav['debugger']->addMessage($my_var)
Event used: onAssetsInitialized
Environment:
Windows 7
Server xampp stack
I enabled the debugger in the user system.yaml file. I also tried enablling it in the system config file (this I changed back to the default).
You might want to try putting a debug message in your onPluginsInitialized method to make sure that’s getting processed. If you are still not seeing anything, you might have a typo in the way you named your folder/classes/yaml files,
Is it possible to get a list of js assets. I see in there is a method in the Assets.php file - getJs() - but it returns an empty array. I would like to check that jquery is available as this plugin rely on the library. Most other functionality rely on jquery but I would like to make sure it’s loaded.
Pages are only aware of their own images/files/videos, you can get those via {{ page.media }}. JQuery will typically be loaded by the theme itself, and you were on the right path by looking in Grav assets, getJs() is what you want, but the problem you ar having is more likely related to when you are checking.
Most plugins add their own assets during the onTwigSiteVariables event, which is pretty late in the process. Also the theme themselves add CSS, and JS assets in the template process, so that is even later around onOutputGenerated. If you check any earlier, there probably is not going to be anything in there yet.
You really have two options primary options at this point.
Continue down your route your going, but put your check in onOutputGenerated. However as the Twig has already been processed at this point, you will probably have to use REGEX to add jquery to the generated output. A bit messy
I would suggest an easier/cleaner approach. Have a plu gin option that when enabled, it simply adds a plugin-provided JQuery reference to Assets object. By default this could be turned off. Then just use documentation to say that this option can be enabled on the plugin if no JQuery is provided by the theme.
The only other alternative would be if Grav were more aware of JQuery, rather than leaving it up to the themes. This could be something as simple as having a JQuery plugin that could be used by all themes. This would solve your problem as you could simply check/require this plugin, but does open up other possible issues related to themes still providing their own versions/libraries. etc.