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.
This commit is contained in:
Matt Porritt 2018-06-14 14:25:52 +10:00
parent 9e7c397889
commit 784ed31ea0

View File

@ -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();