From c93964407e00a52117cb17a80aeaf44ed06b3f6a Mon Sep 17 00:00:00 2001 From: Stephan Robotta Date: Tue, 19 Nov 2024 08:49:38 +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 48534b8fa21..3476978109f 100644 --- a/lib/classes/navigation/output/primary.php +++ b/lib/classes/navigation/output/primary.php @@ -208,6 +208,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'] ?? '/';