-
Bug
-
Resolution: Fixed
-
Minor
-
3.9.12, 3.10.9, 3.11.5, 4.0
-
MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
-
MOODLE_311_STABLE
-
MDL-73993-master -
The method docs say it returns an array where key is the module name and the value is the human-readable string, but in fact it returns lang_string object (because lazyload is set to true) https://github.com/moodle/moodle/blob/master/course/lib.php#L566-L567
It works perfectly across Moodle as lang_string has a magic method __toString() https://github.com/moodle/moodle/blob/master/lib/moodlelib.php#L10658-L10665
However, it doesn't work when lang_string is encoded into a json string:
$name = $cminfo->get_module_type_name();
|
echo('Mod name: ' . $name); |
echo('Mod name json: ' . json_encode($name)); |
has the following output:
Mod name: Assignment
|
Mod name json: {}
|