H5P module edit screen in moodle throws error when local_metadata plugin is enabled for modules.

Description

We are using the moodle plugin local_metadata 3.6.0 in moodle 3.5.1 and H5P 1.17.2. We receive the following error if we have module metadata (metadatacontext_module | metadataenabled) enabled on the site:
{{error/invalidhvp

Stack trace:
line 482 of /lib/setuplib.php: moodle_exception thrown
line 181 of /mod/hvp/mod_form.php: call to print_error()
line 476 of /course/moodleform_mod.php: call to mod_hvp_mod_form->data_preprocessing()
line 198 of /local/metadata/context/module/classes/context_handler.php: call to moodleform_mod->set_data()
line 424 of /local/metadata/lib.php: call to metadatacontext_module\context_handler->coursemodule_standard_elements()
line 743 of /course/moodleform_mod.php: call to local_metadata_coursemodule_standard_elements()
line 731 of /course/moodleform_mod.php: call to moodleform_mod->plugin_extend_coursemodule_standard_elements()
line 117 of /mod/hvp/mod_form.php: call to moodleform_mod->standard_coursemodule_elements()
line 204 of /lib/formslib.php: call to mod_hvp_mod_form->definition()
line 99 of /course/moodleform_mod.php: call to moodleform->__construct()
line 141 of /course/modedit.php: call to moodleform_mod->__construct()}}

I have found that updating the data_preprocessing function inside of "mod/hvp/mod_form.php" corrects the error if the three occurrences of "$defaultvalues['id']" are switched to ""$defaultvalues['instance']". I am not sure is this change has any other side affect I have not noticed, but it appears to me that this change still works when the module metadata is not enabled.

Environment

None

Acceptance Criteria

None

Status

Assignee

Unassigned

Reporter

Adam Welle

Labels

None

Funding

None

Code reviewer

None

Released

None

Time tracking

0m

Fix versions

None

Sprint

None

Priority

Medium