MDL-82877 customfield: pass correct instanceid for restore structure.

This commit is contained in:
Paul Holden
2024-11-04 15:32:04 +00:00
parent d015c4c213
commit e9f56511bc
+4 -1
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);
}