From 194caa005d25d5b5d20727890fc958b4e426f7cd Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Thu, 15 Jan 2026 17:05:36 +0000 Subject: [PATCH] MDL-86609 qbank_bulkmove: Select the current category by default --- question/bank/bulkmove/classes/output/bulk_move.php | 6 +++++- question/bank/bulkmove/tests/behat/bulk_move.feature | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/question/bank/bulkmove/classes/output/bulk_move.php b/question/bank/bulkmove/classes/output/bulk_move.php index 0ffc7ca4f40..f50bfbfb656 100644 --- a/question/bank/bulkmove/classes/output/bulk_move.php +++ b/question/bank/bulkmove/classes/output/bulk_move.php @@ -82,7 +82,11 @@ class bulk_move implements \renderable, \templatable { )[0]; } - $categoryselector = new question_category_selector([$currentbankcm->context], autocomplete: true); + $categoryselector = new question_category_selector( + [$currentbankcm->context], + selected: "{$this->currentcategoryid},{$currentbankcm->context->id}", + autocomplete: true, + ); $savebutton = new single_button( new moodle_url('#'), diff --git a/question/bank/bulkmove/tests/behat/bulk_move.feature b/question/bank/bulkmove/tests/behat/bulk_move.feature index 3c6daa2e01d..1082acf56c4 100644 --- a/question/bank/bulkmove/tests/behat/bulk_move.feature +++ b/question/bank/bulkmove/tests/behat/bulk_move.feature @@ -209,7 +209,7 @@ Feature: Use the qbank plugin manager page for bulkmove And I click on "With selected" "button" And I click on "move" "button" And the field "searchbanks" matches value "C1 - Test quiz" - And the field "selectcategory" matches value "Default for Test quiz" + And the field "selectcategory" matches value "Test questions 1 (2)" And I open the autocomplete suggestions list in the ".search-banks" "css_element" And I should see "C1 - Question bank 1" in the ".search-banks .form-autocomplete-suggestions" "css_element" And I should see "C2 - Question bank 2" in the ".search-banks .form-autocomplete-suggestions" "css_element" @@ -227,7 +227,7 @@ Feature: Use the qbank plugin manager page for bulkmove And I click on "With selected" "button" And I click on "move" "button" And the field "searchbanks" matches value "C1 - Question bank 1" - And the field "selectcategory" matches value "Default for Question bank 1 (1)" + And the field "selectcategory" matches value "Test questions 2 (2)" # The moved question should be highlighted And the "class" attribute of "Seventh question" "table_row" should contain "highlight"