Closed tmuras closed 3 years ago
I had to add these events when creating a mod_*
kind of plugin.
events:
- eventname: course_module_instance_list_viewed
extends: \core\event\course_module_instance_list_viewed
- eventname: course_module_viewed
extends: \core\event\course_module_viewed
They should be suggested, I agree.
Suggested fix:
verify_events_exist()
similar to the existing verify_strings_exist()
prepare_mod_files()
to make sure that the $this->recipe
contains these two events, referenced from view.php and index.phpFor now, the generator will raise warning if the event is missing in the recipe, and the example.yaml has it documented as needed.
For the future, we can try and auto-inject all implicit requirements like this.
view.php generated for module refers to \mod_XXX\event\course_module_viewed class: https://github.com/mudrd8mz/moodle-tool_pluginskel/blob/master/skel/file/mod/view.mustache#L36
but the class is not generated. Therefore the view.php of the module generated will trigger the error:
Exception - Class 'mod_php\event\course_module_viewed' not found