Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
haietza opened this issue Jan 23, 2023 · 0 comments

Comments

@haietza
Copy link
Contributor

haietza commented Jan 23, 2023

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:

  • Create a KVR activity in a Moodle 3.11 site
  • Enable course completion in the course's settings
  • Under the gear menu on the main course page, select Course Completion
  • Select the Default activity completion tab
  • Check the box next to the KVR activity
  • Click the Edit button
  • See the error Coding error detected, it must be fixed by a programmer: Cannot require a CSS file after <head> has been printed.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant