function MenuActiveTrail::doGetActiveTrailIds
Same name in other branches
- 9 core/lib/Drupal/Core/Menu/MenuActiveTrail.php \Drupal\Core\Menu\MenuActiveTrail::doGetActiveTrailIds()
- 8.9.x core/lib/Drupal/Core/Menu/MenuActiveTrail.php \Drupal\Core\Menu\MenuActiveTrail::doGetActiveTrailIds()
- 10 core/lib/Drupal/Core/Menu/MenuActiveTrail.php \Drupal\Core\Menu\MenuActiveTrail::doGetActiveTrailIds()
Helper method for ::getActiveTrailIds().
1 call to MenuActiveTrail::doGetActiveTrailIds()
- MenuActiveTrail::resolveCacheMiss in core/
lib/ Drupal/ Core/ Menu/ MenuActiveTrail.php
File
-
core/
lib/ Drupal/ Core/ Menu/ MenuActiveTrail.php, line 98
Class
- MenuActiveTrail
- Provides the default implementation of the active menu trail service.
Namespace
Drupal\Core\MenuCode
protected function doGetActiveTrailIds($menu_name) {
// Parent ids; used both as key and value to ensure uniqueness.
// We always want all the top-level links with parent == ''.
$active_trail = [
'' => '',
];
// If a link in the given menu indeed matches the route, then use it to
// complete the active trail.
if ($active_link = $this->getActiveLink($menu_name)) {
if ($parents = $this->menuLinkManager
->getParentIds($active_link->getPluginId())) {
$active_trail = $parents + $active_trail;
}
}
return $active_trail;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.