mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-57898 customfield: Set the handler's parent context in course_create
This commit is contained in:
parent
fa25f170b6
commit
2f61fe976c
@ -2490,6 +2490,10 @@ function create_course($data, $editoroptions = NULL) {
|
||||
|
||||
// Save custom fields if there are any of them in the form.
|
||||
$handler = core_course\customfield\course_handler::create();
|
||||
// Make sure to set the handler's parent context first.
|
||||
$coursecatcontext = context_coursecat::instance($category->id);
|
||||
$handler->set_parent_context($coursecatcontext);
|
||||
// Save the custom field data.
|
||||
$data->id = $course->id;
|
||||
$handler->instance_form_save($data, true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user