Commit 236b7b32 authored by David Suissa's avatar David Suissa Committed by David Suissa
Browse files

Issue #3552177 by dydave: Added 'Manage Permissions' and standardized menu...

Issue #3552177 by dydave: Added 'Manage Permissions' and standardized menu labels in Admin Toolbar Search suggestions.
parent ed157259
Loading
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -198,6 +198,18 @@ class SearchLinks {
                ];
              }
            }
            // Add operation link: Manage permissions.
            if ($this->routeExists('entity.' . $content_entity_bundle . '.entity_permissions_form')) {
              $url = Url::fromRoute('entity.' . $content_entity_bundle . '.entity_permissions_form', $params);
              if ($url->access()) {
                $url_string = $url->toString();
                $links[] = [
                  'labelRaw' => $label_base . ' > ' . $this->t('Manage permissions'),
                  'value' => $url_string,
                ];
              }
            }
            // Add operation link: Devel.
            if ($this->moduleHandler->moduleExists('devel') && $this->routeExists('entity.' . $content_entity_bundle . '.devel_load')) {
              $url = Url::fromRoute($route_name = 'entity.' . $content_entity_bundle . '.devel_load', $params);
              if ($url->access()) {
@@ -233,13 +245,18 @@ class SearchLinks {
      $cache_tags = Cache::mergeTags($cache_tags, ['config:menu_list']);
      foreach ($menus as $menu_id => $menu) {
        $route_name = 'entity.menu.edit_form';
        $label_params = [
          '@entity_type' => $menu->getEntityType()->getLabel(),
          '@bundle' => $menu->label(),
        ];
        $label_base = $this->t('@entity_type > @bundle', $label_params);
        $params = ['menu' => $menu_id];
        $url = Url::fromRoute($route_name, $params);
        if ($url->access()) {
          $url_string = $url->toString();

          $links[] = [
            'labelRaw' => $this->t('Menus > @menu_label', ['@menu_label' => $menu->label()]),
            'labelRaw' => $label_base . ' > ' . $this->t('Edit'),
            'value' => $url_string,
          ];
        }
@@ -251,7 +268,7 @@ class SearchLinks {
          $url_string = $url->toString();

          $links[] = [
            'labelRaw' => $this->t('Menus > @menu_label > Add link', ['@menu_label' => $menu->label()]),
            'labelRaw' => $label_base . ' > ' . $this->t('Add link'),
            'value' => $url_string,
          ];
        }
@@ -266,7 +283,7 @@ class SearchLinks {
            $url_string = $url->toString();

            $links[] = [
              'labelRaw' => $this->t('Menus > @menu_label > Delete', ['@menu_label' => $menu->label()]),
              'labelRaw' => $label_base . ' > ' . $this->t('Delete'),
              'value' => $url_string,
            ];
          }
@@ -279,7 +296,7 @@ class SearchLinks {
            $url_string = $url->toString();

            $links[] = [
              'labelRaw' => $this->t('Menus > @menu_label > Devel', ['@menu_label' => $menu->label()]),
              'labelRaw' => $label_base . ' > ' . $this->t('Devel'),
              'value' => $url_string,
            ];
          }