Joomla 5.4.1, multilanguage website.
Italian menu structure:
mod_breadcrumbs config:
Visiting the News page, I expect to see in the breadcrumbs:
Home > News
Home > Home > News
(duplicated Home link)
PHP 8.2.28
Checking the mod_breadcrumbs code and doing some test I guess that the problem is in getHomeItem() function (line 74 of src/Helper/BreadcrumbsHelper.php), setting the link property:
$item->link = 'index.php?Itemid=' . $home->id;
In tmpl/default.php, line 33 the code:
// Get rid of duplicated entries on trail including home page when using multilanguage
for ($i = 0; $i < $count; $i++) {
if ($i === 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link === $list[$i - 1]->link) {
unset($list[$i]);
}
}
attempts to remove the duplicated item, but I can see that the two Home links have different "link" value, here's a dump:
array(3) {
[0]=>
object(stdClass)#1258 (2) {
["name"]=>
string(4) "Home"
["link"]=>
string(20) "index.php?Itemid=102"
}
[1]=>
object(stdClass)#1256 (2) {
["name"]=>
string(4) "Home"
["link"]=>
string(57) "index.php?option=com_content&view=article&id=1&Itemid=102"
}
[2]=>
object(stdClass)#1257 (2) {
["name"]=>
string(4) "News"
["link"]=>
string(53) "index.php?option=com_unipgnews&view=elenco&Itemid=402"
}
}
The first Home (generated by the getHomeItem function) has "index.php?Itemid=102" and the second has "index.php?option=com_content&view=article&id=1&Itemid=102", so the duplicate check fails, leaving two items instead of one.
| Labels |
Added:
No Code Attached Yet
|
||
Fix: mod_breadcrumbs duplicates Home link in multilanguage #46581
@alikon I never created a PR, please check if everything is ok... thanks!
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-12-17 16:33:23 |
| Closed_By | ⇒ | richard67 |
@stefanoel you already made pr's 😃
@stefanoel can you submit a pull request ?