What is permitted for when using $mform->addelement

What is permitted for when using $mform->addelement

by AL Rachels -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I am working on making the view.php page for the Hot Question activity a little more versatile, Currently one of the items on the page is a textarea and it has a language string, that adds submit instructions. More than one user has asked about the possibility of making it possible to easily change the wording of the submit instructions, as the original wording includes "question" which might not fit in all cases.

The original version that adds submission instructions to the textarea looked like this: $mform->addElement('textarea', 'question', get_string('inputquestion', 'hotquestion'), 'wrap="virtual" rows="3" cols="50"');

Using a configuration setting, I can make it possible to change the wording for every occurrence of the activity: $mform->addElement('textarea', 'question', get_config('mod_hotquestion','submitinstructions'), 'wrap="virtual" rows="3" cols="50"');

What I would like is to know if other possibilities exist that I could use for the third item, <displayname>, that would let me get a text from a field of the record for the activity, thus making it possible to have the submit instructions "fit" for whatever use the activity is being put to. e.g. "Submit your suggestion here,  Submit your comments here, Submit your observation here, etc.

$mform->addelement(<elementtype>,<elementidentifier>,<displayname>,<options>);


Average of ratings: -