Frankenstyle: Difference between revisions
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
Martin Dougiamas invented the word 'frankenstyle' to describe this naming system which was invented by Petr Skoda. | Martin Dougiamas invented the word 'frankenstyle' to describe this naming system which was invented by Petr Skoda. | ||
= Format = | == Format == | ||
Frankenstyle component names have a prefix and then a folder name, separated by an underscore. | Frankenstyle component names have a prefix and then a folder name, separated by an underscore. | ||
Line 12: | Line 12: | ||
So the frankenstyle component name for the quiz module is '''mod_quiz'''. | So the frankenstyle component name for the quiz module is '''mod_quiz'''. | ||
= Plugin types = | == Plugin types == | ||
{| class="nicetable" | {| class="nicetable" | ||
Line 164: | Line 164: | ||
To get a definitive list in your version of Moodle 2.x, use a small Moodle script with <tt>print_object(get_plugin_types());</tt>. | To get a definitive list in your version of Moodle 2.x, use a small Moodle script with <tt>print_object(get_plugin_types());</tt>. | ||
= Core subsystems = | == Core subsystems == | ||
Subsystems in Moodle are not plugins themselves but can be referred to using '''core_xxx''' where xxx is the subsystem name as defined in get_core_subsystems(). | Subsystems in Moodle are not plugins themselves but can be referred to using '''core_xxx''' where xxx is the subsystem name as defined in get_core_subsystems(). | ||
Line 237: | Line 237: | ||
|} | |} | ||
= Usage = | == Usage == | ||
Frankenstyle component names are used in: | Frankenstyle component names are used in: | ||
== Table names == | === Table names === | ||
All table names for a plugin must begin with its frankenstyle name (after the standard Moodle table prefix). | All table names for a plugin must begin with its frankenstyle name (after the standard Moodle table prefix). | ||
Line 249: | Line 249: | ||
Examples: mdl_'''local_coolreport''', mdl_'''local_coolreport'''_users | Examples: mdl_'''local_coolreport''', mdl_'''local_coolreport'''_users | ||
== Capabilities == | === Capabilities === | ||
All capabilities for a plugin use the frankenstyle name, except with a / instead of a _. | All capabilities for a plugin use the frankenstyle name, except with a / instead of a _. | ||
Line 255: | Line 255: | ||
Example: '''mod/quiz''':viewattempt | Example: '''mod/quiz''':viewattempt | ||
== Language files== | === Language files=== | ||
The main language file for each plugin (with the notable exception of activity modules) is the frankenstyle component name. | The main language file for each plugin (with the notable exception of activity modules) is the frankenstyle component name. | ||
Line 261: | Line 261: | ||
Examples: /blocks/participants/lang/en/'''block_participants'''.php | Examples: /blocks/participants/lang/en/'''block_participants'''.php | ||
== Renderers == | === Renderers === | ||
== Other places (TODO) == | === Other places (TODO) === | ||
* @package declarations in phpdocs | * @package declarations in phpdocs, see [[Coding_style#PHPDoc]] | ||
* [[Web_services_Roadmap|web service function names]] | * [[Web_services_Roadmap|web service function names]] | ||
* [http://moodle.org Moodle Plugins database] | * [http://moodle.org Moodle Plugins database] |
Revision as of 06:15, 30 January 2012
'Frankenstyle component names' refers to the naming convention that is used to uniquely identify a Moodle plugin based on the type of plugin and its name. They are used throughout the Moodle code (with a notable exception being the css class names in the themes).
Martin Dougiamas invented the word 'frankenstyle' to describe this naming system which was invented by Petr Skoda.
Format
Frankenstyle component names have a prefix and then a folder name, separated by an underscore.
- The prefix is determined by the type of plugin. For example, the prefix for an activity module is mod.
- The name is the folder name of the plugin, always lower case. For example, the name for Quiz is quiz.
So the frankenstyle component name for the quiz module is mod_quiz.
Plugin types
Plugin type | Frankenstyle prefix | Moodle path |
---|---|---|
Activity modules | mod | /mod |
Admin reports | report | /admin/report |
Admin tools | tool | /admin/tool |
Assignment types | assignment | /mod/assignment/type |
Authentication plugins | auth | /auth |
Blocks | block | /blocks |
Core subsystems | core | / (not a true plugin, see below for details) |
Course formats | format | /course/format |
Course reports | coursereport | /course/report |
Database fields | datafield | /mod/data/field |
Database presets | datapreset | /mod/data/preset |
Editors | editor | /lib/editor |
Enrolment plugins | enrol | /enrol |
Filters | filter | /filter |
Gradebook export | gradeexport | /grade/export |
Gradebook import | gradeimport | /grade/import |
Gradebook reports | gradereport | /grade/report |
Grading methods | gradingform | /grade/grading/form |
Local plugins | local | /local |
Messaging consumers | message | /message/output |
Mnet services | mnetservice | /mnet/service |
Plagiarism plugins | plagiarism | /plagiarism |
Portfolio plugins | portfolio | /portfolio |
Question behaviours | qbehaviour | /question/behaviour |
Question formats | qformat | /question/format |
Question types | qtype | /question/type |
Quiz reports | quiz | /mod/quiz/report |
Repository plugins | repository | /repository |
SCORM reports | scormreport | /mod/scorm/report |
Themes | theme | /theme |
User profile fields | profilefield | /user/profile/field |
Webservice protocols | webservice | /webservice |
Workshop allocation strategies | workshopallocation | /mod/workshop/allocation |
Workshop evaluation plugins | workshopeval | /mod/workshop/eval |
Workshop grading forms | workshopform | /mod/workshop/form |
To get a definitive list in your version of Moodle 2.x, use a small Moodle script with print_object(get_plugin_types());.
Core subsystems
Subsystems in Moodle are not plugins themselves but can be referred to using core_xxx where xxx is the subsystem name as defined in get_core_subsystems().
You can see these being used in the @package parameter in phpdocs, or in the webservice function names.
Core subsystem | Frankenstyle component name |
---|---|
Access | core_access |
Conditionals | core_condition |
Comment | core_comment |
Completion | core_completion |
Course | core_course |
Enrol | core_enrol |
Files | core_files |
Forms | core_form |
Grade | core_grade |
Groups | core_group |
Messages | core_message |
Mnet | core_mnet |
My home page | core_my |
Notes | core_notes |
Ratings | core_rating |
Role | core_role |
RSS | core_rss |
Tag | core_tag |
User | core_user |
Web service | core_webservice |
Usage
Frankenstyle component names are used in:
Table names
All table names for a plugin must begin with its frankenstyle name (after the standard Moodle table prefix).
(The exception to this rule is Moodle activities which (for historical reasons) do not have mod_ in front of the plugin name)
Examples: mdl_local_coolreport, mdl_local_coolreport_users
Capabilities
All capabilities for a plugin use the frankenstyle name, except with a / instead of a _.
Example: mod/quiz:viewattempt
Language files
The main language file for each plugin (with the notable exception of activity modules) is the frankenstyle component name.
Examples: /blocks/participants/lang/en/block_participants.php
Renderers
Other places (TODO)
- @package declarations in phpdocs, see Coding_style#PHPDoc
- web service function names
- Moodle Plugins database
Please add more as they come up.