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
description: 'Instructions for GitHub Copilot to generate code in a Moodle project context.'
4
4
---
5
5
6
6
# Project Context
7
7
8
-
This repository contains a Moodle project. It is based on Moodle version XXXX (specify version).
8
+
This repository contains a Moodle project. Ensure that any generated code is compatible with the specific Moodle version used in this project (for example, Moodle 3.11, 4.1 LTS, or later).
9
9
10
10
It includes:
11
11
- Plugin development (local, block, mod, auth, enrol, tool, etc.)
@@ -19,15 +19,15 @@ It includes:
19
19
- PHP must be compatible with the core version (e.g., PHP 7.4 / 8.0 / 8.1).
20
20
- Do not use modern syntax that is not supported by core if it breaks compatibility.
21
21
- Class naming must use Moodle namespaces.
22
-
-Use the MVC structure in plugins (classes/output, classes/form, db/, lang/, templates/…).
- Parameters handled with `required_param()` / `optional_param()`
27
27
28
28
# Code Generation Rules
29
29
30
-
- When creating new classes, use the namespace `vendor\pluginname`.
30
+
- When creating new PHP classes in plugins, use the Moodle component (Frankenstyle) namespace that matches the plugin's component name, e.g. `local_myplugin`, `mod_forum`, `block_mycatalog`, `tool_mytool`.
31
31
- In plugins, always respect the structure:
32
32
- /db
33
33
- /lang
@@ -45,7 +45,7 @@ It includes:
45
45
# Examples of What Copilot Should Be Able to Answer
46
46
47
47
- "Generate a basic local plugin with version.php, settings.php, and lib.php."
48
-
- "Create a new table in install.xml and an upgrade script in upgrade.php."
48
+
- "Create a new table in db/install.xml and an upgrade script in db/upgrade.php."
49
49
- "Generate a Moodle form using moodleform."
50
50
- "Create a renderer with Mustache to display a table."
0 commit comments