You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: general/development/tools/metadata/index.md
+26-4
Original file line number
Diff line number
Diff line change
@@ -41,21 +41,43 @@ The name and location on disk of every plugin type, and subsystem is described i
41
41
42
42
## Subplugins
43
43
44
-
Any plugin which implements a subplugin must describe its subplugins by name and path in that plugins `db/subplugins.json` location.
44
+
Any plugin which supports subplugins must describe its subplugin types by name and path in that plugins `db/subplugins.json` location.
45
45
46
-
<details>
47
-
<summary>Example of a `db/subplugins.json`</summary>
46
+
This file requires that subplugins be specified as a set of key and value pairs where the key is the name of the subplugin type, and the value is the path to it.
47
+
48
+
- The name is the used as a prefix for all namespaces.
49
+
- The path is the path that the plugins exist within.
50
+
51
+
In the following example the subplugins used in `mod_quiz` are described.
52
+
53
+
The Quiz activity module is located in `mod/quiz`. It has two subplugin types, `quiz`, and `quizaccess` which are located in `mod/quiz/report`, and `mod/quiz/accessrule` respectively.
48
54
49
55
```json title="mod/quiz/db/subplugins.json"
50
56
{
57
+
"subplugintypes": {
58
+
"quiz": "report",
59
+
"quizaccess": "accessrule"
60
+
},
51
61
"plugintypes": {
52
62
"quiz": "mod/quiz/report",
53
63
"quizaccess": "mod/quiz/accessrule"
54
64
}
55
65
}
56
66
```
57
67
58
-
</details>
68
+
<Sinceversion="5.0"issueNumber="MDL-83705" />
69
+
70
+
The list of subplugins should be detailed in the `subplugintypes` object which contains a list of the subplugins where the key is the component type, and the value is the path relative to the parent plugin.
71
+
72
+
For Moodle versions 4.5 and earlier the `plugintypes` object is used. The same keys must be used, but the values of `subplugintypes` are relative to the plugin's root directory, whilst the value of `plugintypes` are relative to the Moodle project root.
73
+
74
+
:::danger Plugins supporting Moodle 4.5 and earlier
75
+
76
+
If your plugin supports subplugins and is intended for use for both Moodle 5.0 and later, and Moodle 4.5 or earlier, you should specify both the `subplugintypes` and the `plugintypes` objects.
77
+
78
+
When both objects are specified the keys must match, and the paths relative to the plugin must also match.
0 commit comments