Merge branch 'MDL-82877-405' of https://github.com/paulholden/moodle into MOODLE_405_STABLE

This commit is contained in:
Jun Pataleta 2024-11-15 13:31:26 +08:00
commit 26e68178a8
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7

View File

@ -521,8 +521,11 @@ abstract class handler {
* @param int $oldid The original ID of the custom field data before backup.
*/
public function restore_define_structure(\restore_structure_step $step, int $newid, int $oldid): void {
$datacontrollers = $this->get_instance_data($newid);
// Retrieve the 'instanceid' of the new custom field data.
$instanceid = (new data($newid))->get('instanceid');
$datacontrollers = $this->get_instance_data($instanceid);
foreach ($datacontrollers as $controller) {
$controller->restore_define_structure($step, $newid, $oldid);
}