custom module not passing event observer info to lib.php function

Re: custom module not passing event observer info to lib.php function

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Out of interest - at any point did you try writing:

require_once($CFG->dirroot.'/admin/tool/mytool/lib.php');

Plugin's lib.php files are not loaded automatically on demand, but you can sometimes (by chance) find that they've already been loaded by some other code.

However, putting functions in lib.php is generally a bad idea (except for ones, such as the 'pluginfile' function, which _must_ be there, in order for Moodle core code to find them). You are much better off putting your supporting functions in a suitably-named class, within the classes/ folder of your plugin and letting the automatic class loading code include it when required.
Average of ratings: Useful (1)