MDL-63253 admin: Show location of the found items at search results page

The search results page showed just the titles of the found matching
pages / sections but not their location within the admin tree. In
certain cases, we even have multiple admin pages with the same title -
making it impossible to distinguish which is which.

The patch makes it so that the path of the found admin page / section is
displayed below the title.
This commit is contained in:
David Mudrák
2018-09-17 20:34:31 +02:00
parent 674ef9baac
commit 8b8b9a9415
7 changed files with 129 additions and 7 deletions
+10
View File
@@ -8179,6 +8179,15 @@ function admin_search_settings_html($query) {
continue;
}
// Locate the page in the admin root and populate its visiblepath attribute.
$path = array();
$located = $adminroot->locate($page->name, true);
if ($located) {
foreach ($located->visiblepath as $pathitem) {
array_unshift($path, (string) $pathitem);
}
}
$sectionsettings = [];
if (!empty($settings)) {
foreach ($settings as $setting) {
@@ -8198,6 +8207,7 @@ function admin_search_settings_html($query) {
$tpldata->results[] = (object) [
'title' => $heading,
'path' => $path,
'url' => $headingurl->out(false),
'settings' => $sectionsettings
];