Skip to content
Snippets Groups Projects

Allow the admin page to remain visible when access is given to child items

Closes #3413508

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
117 111
118 112 // If access is allowed to this element in the tree check for access to
119 113 // its own children.
  • 101 101
    102 if (empty($tree)) {
    103 $route = $this->router->getRouteCollection()->get($link->getRouteName());
    104 if ($route) {
    105 return AccessResult::allowedIf(
    106 empty($route->getRequirement('_access_admin_menu_block_page'))
    107 && empty($route->getRequirement('_access_admin_overview_page'))
    108 );
    109 }
    110 return AccessResult::neutral();
    102 $route = $this->router->getRouteCollection()->get($link->getRouteName());
    103 if ($route && empty($route->getRequirement('_access_admin_menu_block_page')) && empty($route->getRequirement('_access_admin_overview_page'))) {
    104 return AccessResult::allowed();
    111 105 }
    112 106
    113 107 foreach ($tree as $element) {
    • Comment on lines 100 to 113

      Given the above change to not check if $tree is empty we can then make the following performance improvement:

      Suggested change
      Applied
      100 $tree = $this->menuLinkTree->load(NULL, $parameters);
      101
      102 $route = $this->router->getRouteCollection()->get($link->getRouteName());
      103 if ($route && empty($route->getRequirement('_access_admin_menu_block_page')) && empty($route->getRequirement('_access_admin_overview_page'))) {
      104 return AccessResult::allowed();
      105 }
      106
      107 foreach ($tree as $element) {
      100 $route = $this->router->getRouteCollection()->get($link->getRouteName());
      101 if ($route && empty($route->getRequirement('_access_admin_menu_block_page')) && empty($route->getRequirement('_access_admin_overview_page'))) {
      102 return AccessResult::allowed();
      103 }
      104
      105 foreach ($this->menuLinkTree->load(NULL, $parameters) as $element) {
    • changed this line in version 10 of the diff

    • Please register or sign in to reply
  • Adam Bramley added 1 commit

    added 1 commit

    • 955b4e67 - Comment + performance improvements.

    Compare with previous version

  • Adam Bramley added 163 commits

    added 163 commits

    Compare with previous version

  • added 85 commits

    • 59dc28c3...1bcc7f34 - 84 commits from branch project:11.x
    • f52484f4 - Merge branch '11.x' of git.drupal.org:project/drupal into 3413508-admin-page-access

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading