From e26394db71c729def9d77e74227d68e72cc98530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Tue, 29 Jul 2025 16:20:36 +0200 Subject: [PATCH] MDL-85511 course: back button for course management course search. --- .../classes/output/manage_categories_action_bar.php | 8 +++++++- .../templates/manage_category_actionbar.mustache | 11 +++++++++++ public/course/tests/behat/course_search.feature | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/public/course/classes/output/manage_categories_action_bar.php b/public/course/classes/output/manage_categories_action_bar.php index 44882bc141c..01314a2d6bf 100644 --- a/public/course/classes/output/manage_categories_action_bar.php +++ b/public/course/classes/output/manage_categories_action_bar.php @@ -154,11 +154,17 @@ class manage_categories_action_bar implements \renderable { * - renderedcontent Rendered content to be displayed in line with the tertiary nav */ public function export_for_template(\renderer_base $output): array { - return [ + $data = [ 'urlselect' => $this->get_dropdown($output), 'categoryselect' => $this->get_category_select($output), 'search' => $this->get_search_form(), 'heading' => $this->heading, ]; + + if ($this->searchvalue !== '') { + $backbutton = new \single_button(new moodle_url('/course/management.php'), get_string('back'), 'get'); + $data['backbutton'] = $backbutton->export_for_template($output); + } + return $data; } } diff --git a/public/course/templates/manage_category_actionbar.mustache b/public/course/templates/manage_category_actionbar.mustache index 9ed3cc04d7e..f35d067c78c 100644 --- a/public/course/templates/manage_category_actionbar.mustache +++ b/public/course/templates/manage_category_actionbar.mustache @@ -78,6 +78,12 @@ "helpicon":false, "attributes":[] }, + "backbutton": { + "url": "https://moodle.local/course/management.php", + "icon": "", + "title": "Back", + "classes": "btn btn-secondary" + }, "search": { "action": "https://moodle.local/admin/search.php", "extraclasses": "my-2", @@ -109,6 +115,11 @@ {{> core/url_select }} {{/categoryselect}} + {{#backbutton}} + + {{/backbutton}} {{#search}}