access data private from func get_fast_modinfo($course)

Re: access data private from func get_fast_modinfo($course)

by Michael Hughes -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Look at the section_info object (in lib.modinfolib.php), as there are a number of properties that are exposed that are backed on to private instance variables, via the _get() and _set() functions.

For instance the "name" property ($info->name) returns the value of the private _name instance variable.

But no, generally, you shouldn't be bypassing instance variable scopes and accessing "private" instance variables, as they're not exposed for a reason.

Most of the*public* properties that you can access are documented in the section_info class' docblock (https://github.com/moodle/moodle/blob/9cd77c4130f55420f7f0b38d3c583a847c977b78/lib/modinfolib.php#L2557)