From 38c2b2ed20c37fd2a7596e68ddcf1b6d2073942f Mon Sep 17 00:00:00 2001 From: Stephan Robotta Date: Tue, 19 Nov 2024 08:39:19 +0100 Subject: [PATCH] MDL-83746 navigation: check host and path for active flag in custom menu --- lib/classes/navigation/output/primary.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/classes/navigation/output/primary.php b/lib/classes/navigation/output/primary.php index 238e2297530..ddbf22285b0 100644 --- a/lib/classes/navigation/output/primary.php +++ b/lib/classes/navigation/output/primary.php @@ -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'] ?? '/';