mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-69906 admin: Display Setup search engine as link only if it is valid
We use auto-generated admin section name here so we need to check that the target section actually exists.
This commit is contained in:
parent
46f977a8bf
commit
b295a88821
2 changed files with 30 additions and 4 deletions
|
@ -11118,7 +11118,7 @@ class admin_setting_searchsetupinfo extends admin_setting {
|
|||
* @return string
|
||||
*/
|
||||
public function output_html($data, $query='') {
|
||||
global $CFG, $OUTPUT;
|
||||
global $CFG, $OUTPUT, $ADMIN;
|
||||
|
||||
$return = '';
|
||||
$brtag = html_writer::empty_tag('br');
|
||||
|
@ -11180,9 +11180,13 @@ class admin_setting_searchsetupinfo extends admin_setting {
|
|||
$row[0] = '3. ' . get_string('setupsearchengine', 'admin');
|
||||
$row[1] = html_writer::tag('span', get_string('no'), array('class' => 'badge badge-danger'));
|
||||
} else {
|
||||
$url = new moodle_url('/admin/settings.php?section=search' . $CFG->searchengine);
|
||||
$row[0] = '3. ' . html_writer::tag('a', get_string('setupsearchengine', 'admin'),
|
||||
array('href' => $url));
|
||||
if ($ADMIN->locate('search' . $CFG->searchengine)) {
|
||||
$url = new moodle_url('/admin/settings.php?section=search' . $CFG->searchengine);
|
||||
$row[0] = '3. ' . html_writer::link($url, get_string('setupsearchengine', 'core_admin'));
|
||||
} else {
|
||||
$row[0] = '3. ' . get_string('setupsearchengine', 'core_admin');
|
||||
}
|
||||
|
||||
// Check the engine status.
|
||||
$searchengine = \core_search\manager::search_engine_instance();
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue