From 5aedb477ef657385092d78a682bdbec4ebe5ae55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Sun, 16 Feb 2025 18:00:08 +0100 Subject: [PATCH] MDL-84549 qbank_managecategories: put "Delete" action last in menu. This is a backport of MDL-82886. --- .../classes/output/category.php | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/question/bank/managecategories/classes/output/category.php b/question/bank/managecategories/classes/output/category.php index f39a23d8b58..ee885be5a15 100644 --- a/question/bank/managecategories/classes/output/category.php +++ b/question/bank/managecategories/classes/output/category.php @@ -148,6 +148,30 @@ class category implements renderable, templatable { 'data-questioncount' => $this->category->questioncount, ] )); + } + + // Sets up export to XML link. + if (qbank::is_plugin_enabled('qbank_exportquestions')) { + $exporturl = new moodle_url( + '/question/bank/exportquestions/export.php', + ['cat' => helper::combine_id_context($this->category)] + ); + if ($courseid !== 0) { + $exporturl->param('courseid', $courseid); + } else { + $exporturl->param('cmid', $cmid); + } + + $menu->add(new action_menu_link( + $exporturl, + new pix_icon('t/download', 'download'), + get_string('exportasxml', 'question'), + false, + )); + } + + // The delete action which should be last. + if ($canmanagecategory) { // Sets up delete link. $deleteurl = new moodle_url( '/question/bank/managecategories/category.php', @@ -178,26 +202,6 @@ class category implements renderable, templatable { )); } - // Sets up export to XML link. - if (qbank::is_plugin_enabled('qbank_exportquestions')) { - $exporturl = new moodle_url( - '/question/bank/exportquestions/export.php', - ['cat' => helper::combine_id_context($this->category)] - ); - if ($courseid !== 0) { - $exporturl->param('courseid', $courseid); - } else { - $exporturl->param('cmid', $cmid); - } - - $menu->add(new action_menu_link( - $exporturl, - new pix_icon('t/download', 'download'), - get_string('exportasxml', 'question'), - false, - )); - } - $children = []; if (!empty($this->category->children)) { foreach ($this->category->children as $child) {