kaltura / moodle_plugin

8 stars 37 forks source link

Coding error detected, it must be fixed by a programmer: Cannot require a CSS file after <head> has been printed. #396

Open haietza opened 1 year ago

haietza commented 1 year ago

When activity completion is enabled for a Moodle course, and the user attempts to update the completion criteria for a Kaltura Video Resource using the default completion settings, the error in the title is displayed.

Steps to replicate:

Stack trace: Coding error detected, it must be fixed by a programmer: Cannot require a CSS file after <head> has been printed.

More information about this error Debug info: /mod/kalvidres/styles.css Error code: codingerror Stack trace:

line 930 of /lib/outputrequirementslib.php: coding_exception thrown
line 41 of /mod/kalvidres/mod_form.php: call to page_requirements_manager->css()
line 214 of /lib/formslib.php: call to mod_kalvidres_mod_form->definition()
line 130 of /course/moodleform_mod.php: call to moodleform->__construct()
line 87 of /completion/classes/defaultedit_form.php: call to moodleform_mod->__construct()
line 109 of /completion/classes/defaultedit_form.php: call to core_completion_defaultedit_form->get_module_form()
line 214 of /lib/formslib.php: call to core_completion_defaultedit_form->definition()
line 56 of /course/editdefaultcompletion.php: call to moodleform->__construct()

It appears the bug is a result of the line of code in mod_form.php line 41. CSS files should not be conditionally included in a Moodle plugin anymore, as they are minimized as part of the framework rendering process. Deleting the line keeps the applied styles but prevents the error. Please fix, thanks.