Score:0

How to add a top-level link to the Admin menu via the links.menu and routing yaml's

cl flag

Let's say I want to add an additional link to the admin toolbar after Reports such as Groups does.

In my_module.routing.yml I have:

my_module.admin:
  path: '/admin/my_module'
  defaults:
    _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
    _title: 'My Module Stuff'
  requirements:
    _permission: 'access administration pages'

In my_module.links.menu.yml I have:

my_module.admin:
  title: My Link
  route_name: 'my_module.admin'
  parent: 'system.admin'
  description: 'Stuff my link does'
  weight: 8

I took these from the corresponding Groups module. When I clear cache, nothing new shows up in the admin toolbar or the admin menu UI settings.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.