Adding this note in case someone else hits a similar problem.
I implemented a plugin which needs to load a JS file. Initially, I added the js file in
onPluginsInitialized with the line (datatables being the plugin)
This worked fine until I changed the site to multilingual, and then the js file was no longer loaded.
The problem was that the Grav System was loading from
en-gb, which is added for multilingual sites.
My solution, which I think is a correct one, and something that may be should be documented in the Multilingual section, is
- Register a callback to
- create a function
- add the assets in that function.