diff --git a/edit_questionpy_form.php b/edit_questionpy_form.php index 4d68ffd..67873e6 100644 --- a/edit_questionpy_form.php +++ b/edit_questionpy_form.php @@ -41,6 +41,10 @@ class qtype_questionpy_edit_form extends question_edit_form { /** @var array current form data set in {@see definition_inner} and added to the question in {@see set_data}. */ private array $currentdata = []; + /** @var package_file_service */ + private package_file_service $packagefileservice; + /** @var api */ + private api $api; /** * Initialize the form. @@ -203,8 +207,7 @@ private function definition_package_settings_search(MoodleQuickForm $mform) { $isfavourite = $ufservice->favourite_exists('qtype_questionpy', 'package', $package->id, $usercontext); $version = $pkgversion->version; } else { - $api = new api(); - $package = $api->get_package_info($packagehash); + $package = $this->api->get_package_info($packagehash); $isfavourite = null; $version = $package->version; }