Added a mod plugin; getting error on instantiation

Re: Added a mod plugin; getting error on instantiation

by Dan Nessett -
Number of replies: 0
OK. I figured out that I needed to add the two events to the Events entry in the Plugin Skeleton Generator listed under the development tab. This created a skeleton with a "classes" folder containing a subfolder "event", which contained two class definitions contained in the php files "course_module_instance_list_viewed.php" and "course_module_viewed.php" The missing class definition was in the second php file.

I had used the skeleton generated from a previous use of the Plugin Skeleton Generator and then added some other supporting php code, all of which I placed in a folder on a development version of Moodle and then pushed the plugin to a GitHub repository. I didn't want to do this again, so I just added the classes folder to the existing plugin code on the development machine.

I then tried to instantiate the plugin, but got the same error. I expected the plugin to look in classes/event to find the class, but the error message still stated, "Class "mod_logic\event\course_module_viewed" not found. That is, it was looking for a folder called event that contained the course_module_viewed class, not a folder called class, which contained a subfolder called event that contained "course_module_viewed.php", which contained the missing class definition.

As is probably evident, I am just learning how to use Moodle, so I am sure there is some easy fix to this problem. I would appreciate any help others can give.