if you have a node in multiple menus e.g. in main (added via "create menu item" in node) and in footer (manually added link to menu) and the menu titles differ, you sometimes get the "wrong" titles. i would expect to get the one which was added via node-edit, but sometimes it is the other.
the reason is because easy_breadcrump just gets all the $menu_links as and afterwards gets the first element from the array $menu_link = reset($menu_links); but the first maybe is not the correct one...
if ($this->config->get(EasyBreadcrumbConstants::USE_MENU_TITLE_AS_FALLBACK)) {
// Try resolve the menu title from the route.
$route_name = $route_match->getRouteName();
$route_parameters = $route_match->getRawParameters()->all();
$menu_links = $this->menuLinkManager->loadLinksByRoute($route_name, $route_parameters);
if (empty($menu_links)) {
....
}
else {
$menu_link = reset($menu_links);
$title = $this->normalizeText($menu_link->getTitle());
if (array_key_exists($title, $replacedTitles)) {
$title = $replacedTitles[$title];
}
if ($this->config->get(EasyBreadcrumbConstants::TRUNCATOR_MODE)) {
$title = $this->truncator($title);
}
}
}
Comments
Comment #2
greg boggsLooks like we need to pull the correct menu! Merge Requests encouraged.
Comment #4
ankitjhakal commentedHi @greg, whats your suggestion here, can we fetch node title in else condition or we can make preferred menu field required. what you think???
Or you are expecting to fetch menu link title from node edit form when no preferred menu is selected.
If any page is not an entity page(node page) then what will we do...
Comment #5
ankitjhakal commentedComment #6
spuky commentedis this still an issue since preferred menu option is there just asking if thats an issue for users ?
Comment #7
spuky commented