Skip to content
Snippets Groups Projects
Commit 2f0e07fa authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2032311 by dawehner: Load all routes for local tasks via getRoutesByNames().

parent 50ae478f
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -192,11 +192,22 @@ public function getLocalTasksForRoute($route_name) {
public function getTasksBuild($route_name) {
$tree = $this->getLocalTasksForRoute($route_name);
$build = array();
// Collect all route names.
$route_names = array();
foreach ($tree as $instances) {
foreach ($instances as $child) {
$route_names[] = $child->getRouteName();
}
}
// Fetches all routes involved in the tree.
$routes = $route_names ? $this->routeProvider->getRoutesByNames($route_names) : array();
foreach ($tree as $level => $instances) {
foreach ($instances as $child) {
$path = $this->getPath($child);
// Find out whether the user has access to the task.
$route = $this->routeProvider->getRouteByName($child->getRouteName());
$route = $routes[$child->getRouteName()];
$map = array();
// @todo - replace this call when we have a real service for it.
$access = menu_item_route_access($route, $path, $map);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment