Skip to main content
Version: main (5.0)

Plugin types

Moodle is a powerful, and very extensible, Learning Management System. One of its core tenets is its extensibility, and this is primarily achieved through the development of plugins.

A wider range of plugin types are available and these should be selected depending on your needs.

Things you can find in all plugins

Although there are many different types of plugin, there are some things that work the same way in all plugin types. Please see the Plugin files documentation that describes common files which are found in many plugin types.

Naming conventions

Plugins typically have at least two names:

  • The friendly name, shown to users, and
  • A machine name used internally.

The machine name must meet the following rules:

  • It must start with a lowercase latin letter
  • It may contain only lowercase latin letters, numbers, and underscores
  • It must end with a lowercase latin letter, or a number
  • The hyphen, and minus character - are not allowed

If a plugin does not meet these requirements then it will be silently ignored.

tip

Plugin name validation takes place in core_component::is_valid_plugin_name() and the following regular expression is used:

/^[a-z](?:[a-z0-9_](?!__))*[](a-z0-9)+$/
Activity module exception

The underscore character is not supported in activity modules for legacy reasons.

Plugin typeComponent name (Frankenstyle)Moodle pathDescriptionMoodle versions
Activity modulesmod/modActivity modules are essential types of plugins in Moodle as they provide activities in courses. For example: Forum, Quiz and Assignment.1.0+
Antivirus pluginsantivirus/lib/antivirusAntivirus scanner plugins provide functionality for virus scanning user uploaded files using third-party virus scanning tools in Moodle. For example: ClamAV.3.1+
Assignment submission pluginsassignsubmission/mod/assign/submissionDifferent forms of assignment submissions2.3+
Assignment feedback pluginsassignfeedback/mod/assign/feedbackDifferent forms of assignment feedbacks2.3+
Book toolsbooktool/mod/book/toolSmall information-displays or tools that can be moved around pages2.1+
Custom fieldscustomfield/customfield/fieldCustom field types, used in Custom course fields3.7+
Database fieldsdatafield/mod/data/fieldDifferent types of data that may be added to the Database activity module1.6+
Database presetsdatapreset/mod/data/presetPre-defined templates for the Database activity module1.6+
LTI sourcesltisource/mod/lti/sourceLTI providers can be added to external tools easily through the external tools interface see Documentation on External Tools. This type of plugin is specific to LTI providers that need a plugin that can register custom handlers to process LTI messages2.7+
File Convertersfileconverter/files/converterAllow conversion between different types of user-submitted file. For example from .doc to PDF.3.2+
LTI servicesltiservice/mod/lti/serviceAllows the implementation of LTI services as described by the IMS LTI specification2.8+
Machine learning backendsmlbackend/lib/mlbackendPrediction processors for analytics API3.4+
Forum reportsforumreport/mod/forum/reportDisplay various reports in the forum activity3.8+
Quiz reportsquiz/mod/quiz/reportDisplay and analyse the results of quizzes, or just plug miscellaneous behaviour into the quiz module1.1+
Quiz access rulesquizaccess/mod/quiz/accessruleAdd conditions to when or where quizzes can be attempted, for example only from some IP addresses, or student must enter a password first2.2+
SCORM reportsscormreport/mod/scorm/reportAnalysis of SCORM attempts2.2+
Workshop grading strategiesworkshopform/mod/workshop/formDefine the type of the grading form and implement the calculation of the grade for submission in the Workshop module2.0+
Workshop allocation methodsworkshopallocation/mod/workshop/allocationDefine ways how submissions are assigned for assessment in the Workshop module2.0+
Workshop evaluation methodsworkshopeval/mod/workshop/evalImplement the calculation of the grade for assessment (grading grade) in the Workshop module2.0+
Blocksblock/blocksSmall information-displays or tools that can be moved around pages2.0+
Question typesqtype/question/typeDifferent types of question (for example multiple-choice, drag-and-drop) that can be used in quizzes and other activities1.6+
Question behavioursqbehaviour/question/behaviourControl how student interact with questions during an attempt2.1+
Question import/export formatsqformat/question/formatImport and export question definitions to/from the question bank1.6+
Text filtersfilter/filterAutomatically convert, highlight, and transmogrify text posted into Moodle.1.4+
Editorseditor/lib/editorAlternative text editors for editing content2.0+
Atto editor pluginsatto/lib/editor/atto/pluginsExtra functionality for the Atto text editor2.7+
Enrolment pluginsenrol/enrolWays to control who is enrolled in courses2.0+
Authentication pluginsauth/authAllows connection to external sources of authentication2.0+
Admin toolstool/admin/toolProvides utility scripts useful for various site administration and maintenance tasks2.2+
Log storeslogstore/admin/tool/log/storeEvent logs storage back-ends2.7+
Availability conditionsavailability/availability/conditionConditions to restrict user access to activities and sections.2.7+
Calendar typescalendartype/calendar/typeDefines how dates are displayed throughout Moodle2.6+
Messaging consumersmessage/message/outputRepresent various targets where messages and notifications can be sent to (email, sms, jabber, ...)2.0+
Course formatsformat/course/formatDifferent ways of laying out the activities and blocks in a course1.3+
Data formatsdataformat/dataformatFormats for data exporting and downloading3.1+
User profile fieldsprofilefield/user/profile/fieldAdd new types of data to user profiles1.9+
Reportsreport/reportProvides useful views of data in a Moodle site for admins and teachers2.2+
Course reportscoursereport/course/reportReports of activity within the courseUp to 2.1 (for 2.2+ see Reports)
Gradebook exportgradeexport/grade/exportExport grades in various formats1.9+
Gradebook importgradeimport/grade/importImport grades in various formats1.9+
Gradebook reportsgradereport/grade/reportDisplay/edit grades in various layouts and reports1.9+
Advanced grading methodsgradingform/grade/grading/formInterfaces for actually performing grading in activity modules (for example Rubrics)2.2+
MNet servicesmnetservice/mnet/serviceAllows to implement remote services for the MNet environment (deprecated, use web services instead)2.0+
Webservice protocolswebservice/webserviceDefine new protocols for web service communication (such as SOAP, XML-RPC, JSON, REST ...)2.0+
Repository pluginsrepository/repositoryConnect to external sources of files to use in Moodle2.0+
Portfolio pluginsportfolio/portfolioConnect external portfolio services as destinations for users to store Moodle content1.9+
Search enginessearch/search/engineSearch engine backends to index Moodle's contents.3.1+
Media playersmedia/media/playerPluggable media players3.2+
Plagiarism pluginsplagiarism/plagiarismDefine external services to process submitted files and content2.0+
Cache storecachestore/cache/storesCache storage back-ends.2.4+
Cache lockscachelock/cache/locksCache lock implementations.2.4+
Themestheme/themeChange the look of Moodle by changing the the HTML and the CSS.2.0+
Local pluginslocal/localGeneric plugins for local customisations2.0+
Content bank content typescontenttype/contentbank/contenttypeContent types to upload, create or edit in the content bank and use all over the Moodle site3.9+
H5P librariesh5plib/h5p/h5plibPlugin type for the particular versions of the H5P integration library.3.9+
Question bank pluginsqbank/question/bankPlugin type for extending question bank functionality.4.0+
Obtaining the list of plugin types known to your Moodle

You can get an exact list of valid plugin types for your Moodle version using the following example:

/plugintypes.php
<?php
define('CLI_SCRIPT', true);
require('config.php');

$pluginman = core_plugin_manager::instance();

foreach ($pluginman->get_plugin_types() as $type => $dir) {
$dir = substr($dir, strlen($CFG->dirroot));
printf(
"%-20s %-50s %s" . PHP_EOL,
$type,
$pluginman->plugintype_name_plural($type),
$dir)
;
}

Plugin type deprecation

When a plugin or subplugin type is no longer needed or is replaced by another plugin type, it should be deprecated. Using components.json or subplugins.json plugin types and subplugin types, respectively, can be marked as deprecated.

The process for plugin and subplugin type deprecation differs slightly to the normal Deprecation process. Unlike with code deprecation, where the deprecated class or method is usually expected to remain functional during the deprecation window, deprecated plugin/subplugin types are treated as end-of-life as soon as they are deprecated.

Once deprecated, core will exclude plugins of the respective plugin type when performing common core-plugin communication, such as with hooks, callbacks, events, and-so-on. In the case of subplugins, the subplugin owner (the component which the subplugin belongs to), must have been updated to remove or replace all references to the subplugins before the time of deprecation.

Class autoloading and string resolution is still supported during the deprecation window, to assist with any plugin migration scripts that may be required.

limitations

Whilst both plugin and subplugin types can be deprecated, only those plugin types which do not support subplugins can be deprecated.

Deprecation process

Deprecation follows a 3 stage process:

  1. The plugin/subplugin type is marked as deprecated (a core version bump is also required).
  2. The plugin/subplugin type is marked as deleted (a core version bump is also required).
  3. Final removal of the plugin/subplugin type from the respective config file.

First stage deprecation

During first stage deprecation, plugins of the respective type may remain installed, but are deemed end-of-life.

This stage gives administrators time to remove the affected plugins from the site, or migrate them to their replacement plugins.

Second stage deprecation

The second stage deprecation is the deletion phase.

If any affected plugins are still present (that is any which have not been uninstalled or migrated yet), the site upgrade will be blocked.

These plugins must be removed before continuing with site upgrade.

Final deprecation

In the final deprecation stage the relevant configuration changes supporting first and second stage deprecation can be removed from the respective config files. This removes the last reference to these plugin/subplugin types.

Deprecating a plugin type

The first phase of plugin type deprecation involves describing the plugin in the deprecatedplugintypes configuration in lib/components.json. The plugin type must also be removed from the plugintypes object.

The second phase of plugin type deprecation involves moving the entry from the deprecatedplugintypes object to the deletedplugintypes object.

Remember

Don't forget to increment the core version number when marking a plugin/subplugin type for either deprecation or deletion. A version bump isn't needed for final removal.

Example of plugin type deprecation config values

To mark a plugin type as deprecated in components.json, the plugin type should be removed from the plugintypes object, and added to a new deprecatedplugintypes object.

lib/components.json demonstrating first stage deprecation of a plugin type
{
"plugintypes": {
...
},
"subsystems": {
...
},
"deprecatedplugintypes": {
"aiplacement": "ai/placement"
}
}

To mark a plugin type as deleted in components.json, the plugin type should be removed from the deprecatedplugintypes object, and added to a new deletedplugintypes object. If the deprecatedplugintypes object is now empty, it may be removed entirely from config.

lib/components.json demonstrating second stage deprecation (deletion) of a plugin type
{
"plugintypes": {
...
},
"subsystems": {
...
},
"deletedplugintypes": {
"aiplacement": "ai/placement"
}
}

Third stage deprecation just removes the plugin type from the deletedplugintypes object. If the deletedplugintypes object is now empty, it may be removed entirely from config.

lib/components.json demonstrating final stage deprecation of a plugin type. The process is the same for subplugin types.
{
"plugintypes": {
...
},
"subsystems": {
...
},
}

Deprecating a subplugin type

To mark a subplugin type as deprecated, edit the component's subplugins.json file, remove the subplugin type from the subplugintypes object and add it to the deprecatedsubplugintypes object. The mark a subplugin type for stage 2 deprecation (deletion), edit the same file and move the subplugin type from the deprecatedsubplugintypes object to the deletedsubplugintypes object.

Following deletion, the plugin/subplugin type can be removed from the respective JSON entirely.

Remember

Don't forget to increment the core version number when marking a plugin/subplugin type for either deprecation or deletion. A version bump isn't needed for final removal.

Example of subplugin type deprecation config values

To mark a subplugin type as deprecated in a component's subplugins.json, the subplugin type should be removed from the subplugintypes object, and added to a new deprecatedsubplugintypes object.

mod/lti/db/subplugins.json demonstrating first stage deprecation of a subplugin type
{
"subplugintypes": {
"ltiservice": "service"
},
"deprecatedsubplugintypes": {
"ltisource": "source"
}
}

To mark a subplugin type as deleted in a component's subplugins.json, the subplugin type should be removed from the deprecatedsubplugintypes object, and added to a new deletedsubplugintypes object. If the deprecatedsubplugintypes object is now empty, it may be removed entirely from config.

mod/lti/db/subplugins.json demonstrating second stage deprecation (deletion) of a subplugin type
{
"subplugintypes": {
"ltiservice": "service"
},
"deletedsubplugintypes": {
"ltisource": "source"
}
}

Third stage deprecation just removes the subplugin type from the deletedsubplugintypes object. If this object is then empty, it may be removed entirely from config.

mod/lti/db/subplugins.json demonstrating final stage deprecation of a subplugin type.
{
"subplugintypes": {
"ltiservice": "service"
}
}

See also