Skip to content

Commit

Permalink
Improving lookup method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackwar committed Mar 28, 2023
1 parent bda3013 commit 747773a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions components/com_tags/src/Service/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,8 @@ public function preprocess($query)
if (isset($query['view']) && $query['view'] == 'tags') {
if (isset($query['parent_id']) && isset($this->lookup[$language]['tags'][$query['parent_id']])) {
$query['Itemid'] = $this->lookup[$language]['tags'][$query['parent_id']];

return $query;
} elseif (isset($this->lookup[$language]['tags'][0])) {
$query['Itemid'] = $this->lookup[$language]['tags'][0];

return $query;
}
} elseif (isset($query['view']) && $query['view'] == 'tag') {
if (isset($query['id'])) {
Expand All @@ -117,16 +113,20 @@ public function preprocess($query)

if (isset($this->lookup[$language]['tag'][implode(',', $id)])) {
$query['Itemid'] = $this->lookup[$language]['tag'][implode(',', $id)];

return $query;
} elseif (isset($this->lookup[$language]['tags'][0])) {
$query['Itemid'] = $this->lookup[$language]['tags'][0];

return $query;
}
}
}

// Check if the active menuitem matches the requested language
if (
!isset($query['Itemid']) && ($active && $active->component === 'com_tags'
&& ($language === '*' || \in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled()))
) {
$query['Itemid'] = $active->id;
}

// If not found, return language specific home link
if (!isset($query['Itemid'])) {
$default = $this->menu->getDefault($language);
Expand Down

0 comments on commit 747773a

Please sign in to comment.