How to add "common module settings" like option

How to add "common module settings" like option

by Rajneel Totaram -
Number of replies: 2
Picture of Core developers Picture of Plugin developers

I'm currently working on developing a Moodle plugin (for v2.7) that needs to add a set of options to the settings page of other modules, similar to how the "common module settings" option is available in all Moodle modules. Can anyone advise me how this can be done? I can't seem to find how this can be done.

This plugin is intended to work with another block (for Learning Analytics) that I'm working on. The additional option that I wish to add to the settings page of other mods is Use for Analytics. The other conditions will be picked from the Activity completion settings.

Previously, we used to have a settings page in our block to choose the activities to monitor. It was similar to the Progressbar block. But having activity configuration options in multiple places isn't very user friendly.

Would appreciate if I can get advice on how this can be done.

Average of ratings: -
In reply to Rajneel Totaram

Re: How to add "common module settings" like option

by Sam Chaffee -
Picture of Core developers

I'm assuming that when you say "settings page of other modules" you mean the instance settings and not the plugin settings for the activity.

Unfortunately, there is no hook into all the activity instance settings that a 3rd-party plugin could use. However, you could modify the core code in course/moodleform_mod.php to add an element to all activities. The "common module" section you refer to is added in the standard_coursemodule_elements method. Take a look there for an idea of how to implement it.

In reply to Sam Chaffee

Re: How to add "common module settings" like option

by Rajneel Totaram -
Picture of Core developers Picture of Plugin developers

I did consider hacking into the core code. Now it seems like that its the only way to do this.

This is something that I want to achieve when you edit the instance for a mod added to the course:

screenshot


Thanks for your help.