<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/21/en/index.php?action=history&amp;feed=atom&amp;title=Development%3ASubplugins</id>
	<title>Development:Subplugins - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/21/en/index.php?action=history&amp;feed=atom&amp;title=Development%3ASubplugins"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Subplugins&amp;action=history"/>
	<updated>2026-04-13T12:51:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Subplugins&amp;diff=82199&amp;oldid=prev</id>
		<title>Marxjohnson: Fixed transposed parameters in example.</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Subplugins&amp;diff=82199&amp;oldid=prev"/>
		<updated>2011-03-23T13:45:52Z</updated>

		<summary type="html">&lt;p&gt;Fixed transposed parameters in example.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:45, 23 March 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An important thing to remember when using lang strings is to prefix the component with the plugin type, as you do with all non-activity blocks.  So to print the name of the &amp;quot;accumulative&amp;quot; workshopform plugin, you&amp;#039;d do&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An important thing to remember when using lang strings is to prefix the component with the plugin type, as you do with all non-activity blocks.  So to print the name of the &amp;quot;accumulative&amp;quot; workshopform plugin, you&amp;#039;d do&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  print_string(&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;workshopform_accumulative&lt;/del&gt;&#039;, &#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pluginname&lt;/del&gt;&#039;);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  print_string(&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pluginname&lt;/ins&gt;&#039;, &#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;workshopform_accumulative&lt;/ins&gt;&#039;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Marxjohnson</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Subplugins&amp;diff=82198&amp;oldid=prev</id>
		<title>Marxjohnson: New page: Sub plugins allow activity modules to be extended without having to change the module&#039;s code.  Each activity module can define a set of subplugin types in &lt;tt&gt;db/subplugins.php&lt;/tt&gt;.  The ...</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Subplugins&amp;diff=82198&amp;oldid=prev"/>
		<updated>2011-03-23T13:45:07Z</updated>

		<summary type="html">&lt;p&gt;New page: Sub plugins allow activity modules to be extended without having to change the module&amp;#039;s code.  Each activity module can define a set of subplugin types in &amp;lt;tt&amp;gt;db/subplugins.php&amp;lt;/tt&amp;gt;.  The ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sub plugins allow activity modules to be extended without having to change the module&amp;#039;s code.&lt;br /&gt;
&lt;br /&gt;
Each activity module can define a set of subplugin types in &amp;lt;tt&amp;gt;db/subplugins.php&amp;lt;/tt&amp;gt;.  The file must contain an array called &amp;lt;tt&amp;gt;$subplugins&amp;lt;/tt&amp;gt;, with the plugin type as the key for the directory containing the plugins. For example, from &amp;lt;tt&amp;gt;mod/workshop/db/subplugins.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 $subplugins = array(&lt;br /&gt;
                    &amp;#039;workshopform&amp;#039;       =&amp;gt; &amp;#039;mod/workshop/form&amp;#039;,&lt;br /&gt;
                    &amp;#039;workshopallocation&amp;#039; =&amp;gt; &amp;#039;mod/workshop/allocation&amp;#039;,&lt;br /&gt;
                    &amp;#039;workshopeval&amp;#039;       =&amp;gt; &amp;#039;mod/workshop/eval&amp;#039;,&lt;br /&gt;
                    );&lt;br /&gt;
This defines 3 plugin types, &amp;lt;tt&amp;gt;workshopform&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;workshopallocation&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;workshopeval&amp;lt;/tt&amp;gt;. The plugins themselves can be found in &amp;lt;tt&amp;gt;mod/workshop/form&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;mod/workshop/allocation&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;mod/workshop/eval&amp;lt;/tt&amp;gt;, respectively.  Each of these directories can contain a number of plugins, each within it&amp;#039;s own subdirectory.&lt;br /&gt;
&lt;br /&gt;
=== Writing a sub-plugin ===&lt;br /&gt;
A sub-plugin has the same structure as a regular plugin.  It will have a &amp;lt;tt&amp;gt;version.php&amp;lt;/tt&amp;gt;, a &amp;lt;tt&amp;gt;lang&amp;lt;/tt&amp;gt; directory, and can have a &amp;lt;tt&amp;gt;db&amp;lt;/tt&amp;gt; directory with an &amp;lt;tt&amp;gt;install.xml&amp;lt;/tt&amp;gt; and all the other hooks you&amp;#039;d expect to see used in any other type of plugin, such as an activity, block, or admin report.&lt;br /&gt;
&lt;br /&gt;
An important thing to remember when using lang strings is to prefix the component with the plugin type, as you do with all non-activity blocks.  So to print the name of the &amp;quot;accumulative&amp;quot; workshopform plugin, you&amp;#039;d do&lt;br /&gt;
 print_string(&amp;#039;workshopform_accumulative&amp;#039;, &amp;#039;pluginname&amp;#039;);&lt;/div&gt;</summary>
		<author><name>Marxjohnson</name></author>
	</entry>
</feed>