How to add/view a activity specific settings by a local plugin

Re: How to add/view a activity specific settings by a local plugin

by Davo Smith -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Sorry -  I thought you were wanting to extend a the plugin's global settings (defined in settings.php), not the per-instance settings when you add an activity to a course.

There is no way to directly extend the instance settings without making a change to the original plugin code - you could use the code that Vitaly has outlined below to add a new navigation item that links to a page that defines your custom settings (or you could do something really nasty like use some javascript to insert the settings into the page after it has loaded, but please, please don't do that). If you do go down the modifying the plugin code route, you'd also need to extend the X_add_instance and X_update_instance function in the plugin's lib.php in order to save your custom settings somewhere (and then make sure they were loaded where you wanted to use them).


In reply to Davo Smith

Re: How to add/view a activity specific settings by a local plugin

by Adam King -
I'm not sure if the OP was looking to do the same but I figured it may not be possible, from what I've read elsewhere; thought I might ask for the sake of clarity though..

I don't hate the idea of extending a settings nav to accomplish this though, maybe even a custom settings page using the contextual identifiers available before being directed to it to give a per-module functionality. As you say, it's much more ideal than a ridiculous approach with JS and it's muich more maintainable than forking the code for the sake of a setting.

Thanks Davo!