Skip to content

Commit c93bdfd

Browse files
authored
Tags router: do not force incorrect Itemid (#40448)
1 parent 1e601c5 commit c93bdfd

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

components/com_tags/src/Service/Router.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,6 @@ public function preprocess($query)
127127
$query['Itemid'] = $active->id;
128128
}
129129

130-
// If not found, return language specific home link
131-
if (!isset($query['Itemid'])) {
132-
$default = $this->menu->getDefault($language);
133-
134-
if (!empty($default->id)) {
135-
$query['Itemid'] = $default->id;
136-
}
137-
}
138-
139130
return $query;
140131
}
141132

@@ -152,9 +143,9 @@ public function build(&$query)
152143
{
153144
$segments = [];
154145

155-
$menuItem = $this->menu->getItem($query['Itemid']);
146+
$menuItem = !empty($query['Itemid']) ? $this->menu->getItem($query['Itemid']) : false;
156147

157-
if ($menuItem->query['option'] == 'com_tags') {
148+
if ($menuItem && $menuItem->query['option'] == 'com_tags') {
158149
if ($menuItem->query['view'] == 'tags' && isset($query['id'])) {
159150
$ids = $query['id'];
160151

0 commit comments

Comments
 (0)