Adding custom field to EVERY activity module

Re: Adding custom field to EVERY activity module

by Marcus Green -
Number of replies: 3
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You could use coursemodule_standard_elements in the lib.php file of your module
https://docs.moodle.org/dev/Callbacks
e.g.
/**
* @param moodleform $formwrapper The moodle quickforms wrapper object.
* @param MoodleQuickForm $mform The actual form object (required to modify the form).
*/
function frankenstyle_pluginname_coursemodule_standard_elements($formwrapper, $mform) {
global $DB;
$course = $formwrapper->get_course();
$modulename = $formwrapper->get_current()->modulename;
if ($modulename == 'assign') {
do something or other
Average of ratings: Useful (2)
In reply to Marcus Green

Re: Adding custom field to EVERY activity module

by Daniel Neis Araujo -
Picture of Core developers Picture of Plugin developers Picture of Translators
For anybody looking for having custom fields in every activity module, you can use the following plugin:
https://moodle.org/plugins/local_modcustomfields
It uses the callbacks to implement the Custom Field API for activity modules.
Average of ratings: Useful (3)
In reply to Marcus Green

Re: Adding custom field to EVERY activity module

by Lukas Celinak -
Picture of Plugin developers
Hi Marcus, thank you, can i ask if is some way how to load something into standard custom elements, or standard intro elements for moodle, after storing data as custom field?

Thanks.