From 784ed31ea079fac8ae503d6f696ba9b7d8fcc83d Mon Sep 17 00:00:00 2001 From: Matt Porritt Date: Thu, 14 Jun 2018 14:25:52 +1000 Subject: [PATCH] MDL-62705 Global Search: results order selection does not display As of 3.5 a search plugin can define the result orders it supports. When a search plugin defines multiple sort orders and the search is conducted without a context (no context query param in the URL), the code to load the available sort orders from the enabled search backend is never called. This patch gets the supported search orders for the enabled search engine regardless of context being provided or not. As prior, the search order selection will not display if the only result order option is relevance. --- search/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/search/index.php b/search/index.php index 638aff738b5..02f7ea83666 100644 --- a/search/index.php +++ b/search/index.php @@ -76,9 +76,10 @@ if ($contextid) { $customdata['withincourseid'] = $coursecontext->instanceid; } - // Get available ordering options from search engine. - $customdata['orderoptions'] = $search->get_engine()->get_supported_orders($context); } +// Get available ordering options from search engine. +$customdata['orderoptions'] = $search->get_engine()->get_supported_orders($context); + $mform = new \core_search\output\form\search(null, $customdata); $data = $mform->get_data();