Developing a course format plugin

Developing a course format plugin

by hajar zankadi -
Number of replies: 5

Hello 

I hope you are doing very well

I want to develop a course format plugin so i am confused about from where to start.

I have my moodle project in Eclipse PDT (I run moodle from wampserver and I also configured the project so it is synchronized with Git), i created a new directory under course/format/mydirectory.

i tried to follow the instructions highlighted in moodle documentation and i also see examples of other plugins.

My concern is I don't know where to modify an existing plugin or how to start my development .

any advices or help 

Thank you in advance


Average of ratings: -
In reply to hajar zankadi

Re: Developing a course format plugin

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
A course format is a relatively complex type of plugin to create. My advice for getting started would be to create a copy of one of the core plugins (e.g. topics), then create a copy of it and call it something like "mytopics" or "topics2". You'll need to change all the references to "topics" and "format_topics" in your copy to refer to your plugin's name instead.

Once you've done this, you should be able to switch a course to use your format, and it will look exactly like the core format. Now, choose one thing you would like to change about the course format. Work out where in the code the thing you'd like to change is created, then make changes to that piece of code until it does what you want.

If you get stuck, ask questions here being as specific as possible about what you are trying to achieve, how you have tried to achieve it (the code you've changed and how), and what's happening instead (including the text of any error messages you see).

Once you've made changes successfully several times, you'll have a better idea how a course format works. At this stage, you may decide that you want to start over on a new format plugin, or continue making further modifications until you end up with the format you want.
In reply to Mark Johnson

Re: Re: Developing a course format plugin

by hajar zankadi -
Thank you for your advices I will try those steps kind regards
In reply to hajar zankadi

Re: Re: Re: Developing a course format plugin

by hajar zankadi -
I have another question, where to change in code so that my course format be available among the other format in my moodle, is it in edit_form.php? correct me if i'm wrong. Thank you
In reply to hajar zankadi

Re: Re: Re: Re: Developing a course format plugin

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

You will need to run the moodle upgrade script (by visiting /admin/index.php or running the install script) to install the new plugin.