I will provide a small update regarding
#49
π
[regression] missing menu active trail in Drupal 9.5.9
Needs work
. I fixed my own issue with active trail by decorating menu.active_trail
service /Drupal/Core/Menu/MenuActiveTrail.php
and changed getActiveLink
method to have last link from $links variable.
This how it's looks:
/*
* Select the last matching link. I've done this because of duplicated
* menu items.
* On some block-menus we have set second depth of menu items.
* If we have two identical menu items in one menu - it will not appear
* because first link is selected (with lower(0) depth).
*/
if ($links) {
$found = end($links);
}
}
return $found;
Basically, i've just changed $found = reset($links);
from parent to $found = end($links);
in my case. So, we receiving sorted by depth, weight and ID $links
array from $this->menuLinkManager->loadLinksByRoute
and in case we will have more than one link - the link with more depth will be active.
Fully agree with #45. Have the same issue with active trail for menu items that duplicated multiple times ( they all are enabled ), some of them have 1 level in menu tree, some 2 ( all menu items located in `main` menu ).
Because of that, on node page for this menu item - I don't have second main menu that configured to show 2 level or greater.
Is there any quick solution for this (without deleting duplicates)? I've tried #30 on Drupal 9.5.1 but it's not work for me (patch applied but nothing changed).