From 2bfe879e6959548ae74a1e8e1a69ee36f9043683 Mon Sep 17 00:00:00 2001 From: Jan Britz Date: Thu, 5 Dec 2024 12:29:01 +0100 Subject: [PATCH 1/2] fix: use `$this->api` property --- edit_questionpy_form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edit_questionpy_form.php b/edit_questionpy_form.php index 4d68ffd..efbd1a3 100644 --- a/edit_questionpy_form.php +++ b/edit_questionpy_form.php @@ -25,6 +25,7 @@ use core\di; use core_question\local\bank\question_edit_contexts; use qtype_questionpy\api\api; +use qtype_questionpy\api\qpy_http_client; use qtype_questionpy\form\context\root_render_context; use qtype_questionpy\localizer; use qtype_questionpy\package\package; @@ -203,8 +204,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; } From 0f75904ca736f3530e86ae8c1ed3ed3fe85e44ae Mon Sep 17 00:00:00 2001 From: Jan Britz Date: Thu, 5 Dec 2024 14:47:42 +0100 Subject: [PATCH 2/2] fix: add missing property declarations --- edit_questionpy_form.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/edit_questionpy_form.php b/edit_questionpy_form.php index efbd1a3..67873e6 100644 --- a/edit_questionpy_form.php +++ b/edit_questionpy_form.php @@ -25,7 +25,6 @@ use core\di; use core_question\local\bank\question_edit_contexts; use qtype_questionpy\api\api; -use qtype_questionpy\api\qpy_http_client; use qtype_questionpy\form\context\root_render_context; use qtype_questionpy\localizer; use qtype_questionpy\package\package; @@ -42,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.