diff -u b/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php --- b/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -293,8 +293,8 @@ $route_parameters = $child->getRouteParameters($this->routeMatch); // Find out whether the user has access to the task. - $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account); - if ($access) { + $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE); + if ($access->isAllowed()) { $active = $this->isRouteActive($current_route_name, $route_name, $route_parameters); // The plugin may have been set active in getLocalTasksForRoute() if @@ -305,8 +305,8 @@ $route_parameters = $child->getRouteParameters($this->routeMatch); // Find out whether the user has access to the task. - $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account, TRUE); - if ($access->isAllowed()) { + $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account); + if ($access) { $active = $this->isRouteActive($current_route_name, $route_name, $route_parameters); // The plugin may have been set active in getLocalTasksForRoute() if @@ -315,6 +315,7 @@ '#access' => $access, ); } + \Drupal::service('renderer')->addDependency($build, $access); } } return $build; @@ -327,7 +328,6 @@ '#access' => $access, ); } - \Drupal::service('renderer')->addDependency($build, $access); } } return $build; diff -u b/core/modules/system/src/Plugin/Block/SystemPageActionsBlock.php b/core/modules/system/src/Plugin/Block/SystemPageActionsBlock.php --- b/core/modules/system/src/Plugin/Block/SystemPageActionsBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPageActionsBlock.php @@ -101,7 +101,7 @@ $route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME); $action_links = $this->localActionManager->getActionsForRoute($route_name) + $links['actions']; if (empty($action_links)) { - return FALSE; + return []; } $build['action_links'] = $action_links; @@ -128,7 +128,7 @@ */ public function getCacheMaxAge() { // @todo Make me cacheable now that https://drupal.org/node/2287071 has landed. - return FALSE; + return 0; } } diff -u b/core/modules/system/src/Plugin/Block/SystemPageTabsBlock.php b/core/modules/system/src/Plugin/Block/SystemPageTabsBlock.php --- b/core/modules/system/src/Plugin/Block/SystemPageTabsBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPageTabsBlock.php @@ -72,7 +72,7 @@ public function build() { $tabs = menu_local_tabs(); if (empty($tabs)) { - return FALSE; + return []; } $build['tabs'] = $tabs; return $build; @@ -97,7 +97,7 @@ */ public function getCacheMaxAge() { // @todo Make cacheable now that https://drupal.org/node/2287071 has landed. - return FALSE; + return 0; } } diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -775,14 +775,6 @@ } break; - case 'system_page_actions_block': - $variables['action_links'] = $variables['content']['action_links']; - break; - - case 'system_page_tabs_block': - $variables['tabs'] = $variables['content']['tabs']; - break; - case 'system_powered_by_block': $variables['attributes']['role'] = 'complementary'; break; @@ -798,6 +790,14 @@ } break; + case 'system_page_actions_block': + $variables['action_links'] = $variables['content']['action_links']; + break; + + case 'system_page_tabs_block': + $variables['tabs'] = $variables['content']['tabs']; + break; + case 'system_powered_by_block': $variables['attributes']['role'] = 'complementary'; break;