Where are mod variables described?

Where are mod variables described?

by Dan Nessett -
Number of replies: 2
Hello. I have added an activity module named logic (mod_logic). At present, it is just a skeleton, and I will be using a debugger (netbeans) to incrementally add functionality. I am new to Moodle, so this may be an elementary question.

When I added the plugin and then in a test course added a homework item instantiating the mod_logic activity, I get the following undefined variable strings: logicname, logicsettings and logicfieldset (all three are shown in double square brackets - see attachment). Previously, I solved the same problem with the variable modulename by defining it in lang/en/logic.php. However, I don't know what values to choose for these other variables. Is there documentation on what values they should take?

Attachment Screenshot 2023-06-02 at 5.23.35 PM.jpg
Average of ratings: -
In reply to Dan Nessett

Re: Where are mod variables described?

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

The names of the form's string identifiers are arbitrary.

So in mod/logic/mod_form.php if you have:

    function definition() {
        $mform = $this->_form;
        $mform->addElement('text', 'name', get_string('logicname', 'mod_logic'), array('size'=>'64'));

Then this will use the string identifier 'logicname' from the above call to get_string(). You must define this string in your language file – mod/logic/lang/en/logic.php – and purge caches (or bump the plugin version number) so Moodle reads the changes to the language file.

Average of ratings: Useful (1)