General developer forum

standard course module elements mandatory

 
Raymond
standard course module elements mandatory
 

Hi all,

How can I make all the standard course module elements mandatory in my activity plugin? I mean, right now, in my code, I'm just calling them using this:

$this->standard_coursemodule_elements();

But I'd need to make them mandatory in the module so that an ID Number always exists in the plugin.

How can I achieve this?


 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: standard course module elements mandatory
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

You can just call

$mform->addRule('cmidnumber', get_string('required'), 'required', null, 'client');
after you have called standard_coursemodule_elements().

 
Average of ratings: -
Raymond
Re: standard course module elements mandatory
 

Solved! hahahahaa, joy at last!!! Thank you man, its working perfectly!!

 
Average of ratings: -