MDL-83746 navigation: check host and path for active flag in custom menu

This commit is contained in:
Stephan Robotta 2024-11-19 08:39:19 +01:00
parent 269a8a8a1b
commit 38c2b2ed20

View File

@ -217,6 +217,12 @@ class primary implements renderable, templatable {
$pathmatches = false;
// Check for same host names before comparing the path.
$currenthost = array_key_exists('host', $current) ? strtolower($current['host']) : '';
$nodehost = array_key_exists('host', $nodeurl) ? strtolower($nodeurl['host']) : '';
if ($currenthost !== $nodehost) {
return false;
}
// Exact match of the path of node and current url.
$nodepath = $nodeurl['path'] ?? '/';
$currentpath = $current['path'] ?? '/';