Skip to content

Commit

Permalink
Merge branch 'MDL-80919' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyatregubov committed Mar 19, 2024
2 parents 87f5d69 + f917baf commit d567ba9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions course/format/classes/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -2012,9 +2012,13 @@ public function duplicate_section(section_info $originalsection): section_info {
course_update_section($course, $newsection, $newsection);

$modinfo = $this->get_modinfo();
foreach ($modinfo->sections[$originalsection->section] as $modnumber) {
$originalcm = $modinfo->cms[$modnumber];
duplicate_module($course, $originalcm, $newsection->id, false);

// Duplicate the section modules, should they exist.
if (array_key_exists($originalsection->section, $modinfo->sections)) {
foreach ($modinfo->sections[$originalsection->section] as $modnumber) {
$originalcm = $modinfo->cms[$modnumber];
duplicate_module($course, $originalcm, $newsection->id, false);
}
}

return get_fast_modinfo($course)->get_section_info_by_id($newsection->id);
Expand Down

0 comments on commit d567ba9

Please sign in to comment.