Problem with XMLDB and sub plugin

Problem with XMLDB and sub plugin

by Justin Wyllie -
Number of replies: 2

Hi

I have a plugin say /mod/myplugin

I've added a sub plug in /mod/myplugin/mysubplugin

I have an empty /db folder as in /mod/myplugin/mysubplugin/db

When I go to XMLDB Editor to create the install.xml file I don't see the folder mod/myplugin/mysubplugin/db and so can't create the XML file.

What do I need to do to get XMLDB Editor to recognize my sub plugin?

 

 

 

Average of ratings: -
In reply to Justin Wyllie

RESOLVED: Problem with XMLDB and sub plugin

by Justin Wyllie -

Ok.

I copied /mod/workshop and did something like this:

in mod/myplugin/db/subplugins.php I registered a plugin:

'mysubplugin' => 'mod/myplugin/mysubplugin'

And in the folder /mod/myplugin/mysubplugin/ I created a folder which has a basic plugin structure so I had: /mod/myplugin/mysubplugin/subpluginname

Doing this the plugin registration system in moodlelib picked up the mysubplugin folder and searched it for the actual plugins and registered it.

Or something like that.

 

 

 

 

In reply to Justin Wyllie

Re: RESOLVED: Problem with XMLDB and sub plugin

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've just written a Moodle Docs page explaining (briefly) how it works: http://docs.moodle.org/en/Development:Subplugins

In subplugins.php you actually register a plugin type:

'mysubplugintype' => '/mod/myplugin/mysubplugintype'

then create a plugin in the directory for the plugin type, e.g. /mod/myplugin/mysubplugintype/mysubplugin1. You can also create /mysubplugin2 etc. in the same directory.