MDL-84549 qbank_managecategories: put "Delete" action last in menu.

This is a backport of MDL-82886.
This commit is contained in:
Luca Bösch
2025-04-01 17:58:18 +02:00
parent 137f093797
commit 5aedb477ef
@@ -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) {