Skip to content

Commit 22d8a8c

Browse files
Update tag router to restrict lossy matches to menu items set to any (joomla#42162)
1 parent 5fefa07 commit 22d8a8c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/com_tags/src/Service/Router.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ protected function buildLookup()
363363
$items = $this->app->getMenu()->getItems(['component_id'], [$component->id]);
364364

365365
foreach ($items as $item) {
366+
$itemParams = $item->getParams();
367+
366368
if (!isset($this->lookup[$item->language])) {
367369
$this->lookup[$item->language] = ['tags' => [], 'tag' => []];
368370
}
@@ -372,8 +374,11 @@ protected function buildLookup()
372374
sort($id);
373375
$this->lookup[$item->language]['tag'][implode(',', $id)] = $item->id;
374376

375-
foreach ($id as $i) {
376-
$this->lookup[$item->language]['tag'][$i] = $item->id;
377+
// Only apply to menu items with match type any
378+
if ($itemParams->get('return_any_or_all') == 1) {
379+
foreach ($id as $i) {
380+
$this->lookup[$item->language]['tag'][$i] = $item->id;
381+
}
377382
}
378383
}
379384

0 commit comments

Comments
 (0)