MDL-79118 output: account for empty node/current URL path element.
This commit is contained in:
@@ -194,12 +194,15 @@ class primary implements renderable, templatable {
|
||||
$current = parse_url($FULLME ?? '');
|
||||
|
||||
$pathmatches = false;
|
||||
|
||||
// Exact match of the path of node and current url.
|
||||
if ($nodeurl['path'] === $current['path']) {
|
||||
$nodepath = $nodeurl['path'] ?? '/';
|
||||
$currentpath = $current['path'] ?? '/';
|
||||
if ($nodepath === $currentpath) {
|
||||
$pathmatches = true;
|
||||
}
|
||||
// The current url may be trailed by a index.php, otherwise it's the same as the node path.
|
||||
if (!$pathmatches && $nodeurl['path'] . 'index.php' === $current['path']) {
|
||||
if (!$pathmatches && $nodepath . 'index.php' === $currentpath) {
|
||||
$pathmatches = true;
|
||||
}
|
||||
// No path did match, so the node can't be active.
|
||||
|
||||
Reference in New Issue
Block a user