As part of a set of changes which we are currently looking to integrate, we are considering making some changes to the way in which core defines its list of plugintypes and subsystems, and the way in which plugins define their subplugins.
These changes are discussed in MDL-62497.
Currently, if a plugin supports subplugins (e.g. mod_assign, mod_book, mod_lti, etc.) then it must define a db/subplugins.php file which specifies the prefix of the subplugin, and its path.
We are looking at moving this to a JSON structure in Moodle 3.7 such that it can be read by parts of our tooling process that are not able to use PHP.
We are also looking at moving the hard-coded list of plugin types, and subsytems to a similar JSON structure in lib/components.json.
Exact details are still to be confirmed.
Why can't you just use PHP?
Much of our Continuous Integration system makes use of Docker.
Our PHP images do not have NodeJS installed, and our Node images do not have PHP installed.
In addition to this, linking Node and PHP sets a potentially difficult precedent which we feel we should avoid.
Can't you just install Node in your PHP images?
Technically yes, but one version of PHP may support as many as five versions of Moodle, whilst one version of Moodle is only intended to be built with one major version of NodeJS.
We need to be able to switch versions of Node in-line with Moodle, but that may not tie to a specific version of PHP.
Whilst we could use NVM, this further complicates the build processes.
But what about my plugin..?
If you have a plugin, and that plugin defines a set of subplugins, then we will be encouraging you to move the db/subplugins.php file to a JSON structure.
We are aware that it's pretty common to have a single version of a plugin used by many versions of Moodle and we intend to provide a recommended compatability version of te subplugins.php which loads its data from the JSON structure.
This will allow you to have one authoritative structure used.
That sounds cool... can I use it?
You'll be able to use these subplugins.json files, and the core lib/components.json if you have specific needs - for example in Continuous Integration tooling.
Can't you keep the PHP source authoritative and just build this?
In theory we could do so, and we did originally propose to do so, but then we need to have PHP available to NodeJS, and we encounter the limitations described above. Alternatively we need to add a build step whereby you generate an up-to-date copy of the cached structure as part of your build process... which is a more frustrating task than just doing it as a one-off change.
If you have any questiosn, please ask me.
We will update the documentation as part of this change.