Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Frankenstyle: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 1: Line 1:
'Frankenstyle' 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).
'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.
Martin Dougiamas invented the word 'frankenstyle' to describe this naming system which was invented by Petr Skoda.
Line 5: Line 5:
= Format =
= Format =


Frankenstyle names have a prefix and then a name, separated by an underscore.  
Frankenstyle component names have a prefix and then a 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 prefix is determined by the type of plugin. For example, the prefix for an activity module is '''mod'''.
* The name is the name of the plugin. (Plugin names are always made of lower-case letters.)
* The name is the name of the plugin. (Plugin names are always made of lower-case letters.)


So the frankenstyle name for the quiz module is '''mod_quiz'''.
So the frankenstyle component name for the quiz module is '''mod_quiz'''.


= Plugin types =
= Plugin types =


* Activity modules: [mod] => /mod
{| class="nicetable"
* Admin reports: [report] => /admin/report
|-
* Assignments: [assignment] => /mod/assignment/type
! Plugin name
* Authentication plugins: [auth] => /auth
! Frankenstyle
* Blocks:  [block] => /blocks
! Moodle path
* Course formats:  [format] => /course/format
|-
* Course reports: [coursereport] => /course/report
| Activity modules
* Database field types: [datafield] => /mod/data/field
| mod
* Database presets:  [datapreset] => /mod/data/preset
| /mod
* Editors: [editor] => /lib/editor
|-
* Enrolment plugins: [enrol] => /enrol
| Admin reports
* Filters: [filter] => /filter
| report
* Grade export plugins: [gradeexport] => /grade/export
| /admin/report
* Grade import plugins: [gradeimport] => /grade/import
|-
* Grade reports:  [gradereport] => /grade/report
| Assignments
* Local plugins: [local] => /local
| assignment
* Messaging consumers: [message] => /message/output
| /mod/assignment/type
* Mnet services: [mnetservice] => /mnet/service
|-
* Plagiarism plugins: [plagiarism] => /plagiarism
| Authentication plugins
* Portfolio plugins: [portfolio] => /portfolio
| auth
* Question behaviours: [qbehaviour] => /question/behaviour
| /auth
* Question formats: [qformat] => /question/format
|-
* Question types: [qtype] => /question/type
| Blocks
* Quiz reports: [quiz] => /mod/quiz/report
| block
* Repository plugins: [repository] => /repository
| /blocks
* SCORM reports: [scormreport] => /mod/scorm/report
|-
* Themes: [theme] => /theme
| Course formats
* User profile fields:  [profilefield] => /user/profile/field
| format
* Webservice protocols: [webservice] => /webservice
| /course/format
* Workshop allocation strategies:  [workshopallocation] => /mod/workshop/allocation
|-
* Workshop evaluation plugins: [workshopeval] => /mod/workshop/eval
| Course reports
* Workshop grading forms: [workshopform] => /mod/workshop/form
| coursereport
| /course/report
|-
| Database field types
| datafield
| /mod/data/field
|-
| Database presets
| datapreset
| /mod/data/preset
|-
| Editors
| editor
| /lib/editor
|-
| Enrolment plugins
| enrol
| /enrol
|-
| Filters
| filter
| /filter
|-
| Grade export plugins
| gradeexport
| /grade/export
|-
| Grade import plugins
| gradeimport
| /grade/import
|-
| Grade reports
| gradereport
| /grade/report
|-
| 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 <tt>print_object(get_plugin_types());</tt>.


To get a definitive list, do <tt>print_object(get_plugin_types());</tt> in a Moodle 2.x install.


= Usages =
= Usages =
Line 64: Line 168:


Example: '''mod/quiz''':viewattempt
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


== Other places (TODO) ==
== Other places (TODO) ==


Please add more as they come up.
Please add more as they come up.

Revision as of 05:21, 30 August 2011

'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 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 name of the plugin. (Plugin names are always made of lower-case letters.)

So the frankenstyle component name for the quiz module is mod_quiz.

Plugin types

Plugin name Frankenstyle Moodle path
Activity modules mod /mod
Admin reports report /admin/report
Assignments assignment /mod/assignment/type
Authentication plugins auth /auth
Blocks block /blocks
Course formats format /course/format
Course reports coursereport /course/report
Database field types datafield /mod/data/field
Database presets datapreset /mod/data/preset
Editors editor /lib/editor
Enrolment plugins enrol /enrol
Filters filter /filter
Grade export plugins gradeexport /grade/export
Grade import plugins gradeimport /grade/import
Grade reports gradereport /grade/report
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());.


Usages

Frankenstyle is used in:

Table names

All table names for a plugin must begin with its frankenstyle name (after the standard Moodle table prefix).

Examples: mdl_mod_quiz, mdl_mod_quiz_attempts

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


Other places (TODO)

Please add more as they come up.