1

How can I add a section to the admin/config route and populate it with my own modules? In Drupal 7 it was easy, but I can't figure it out now in Drupal 8. The closest I can get is adding my modules to the Configuration Menu List that appears in the sidebar.

module.links.menu.yml

module.admin_settings:
  title: 'Module Admin Title'
  description: 'Module Admin Desc.'
  route_name: my_module.my_module_settings
  parent: system.admin_config
1

You must add a menu link and a router item for the page:

  1. Add a menu link in my_module.links.menu.yml. See core/modules/system/system.links.menu.yml:

my_module.my_group_menu: parent: system.admin_config route_name: my_module.my_group

  1. Add a router item in my_module.routing.yml, which can re-use the same controller: SystemController::systemAdminBlockPage(). See core/modules/system/system.routing.yml for an example.

my_module.my_group: path: '/admin/config/my-group'

  1. Then add your menu link to your settings page as a parent to the menu link you created in #1.
3
  • Just I started Drupal8. So as u mentioned above parent: system.admin_config. If I used this I will get section name as CONFIGURATION bcz ts mentioned in that particular route. I want to create seperate section with my own choce of name. Is it possible or not. I dont want to use already defined route paths.
    – Suraj
    May 26 '17 at 13:59
  • Yes, you would make the parent my_module.admin_SECTION and define a menu link for that as well and make its parent system.admin. Then make a corresponding route that is exactly like in system.routing.yml. See the answer above for all the respective links you need to look at for what I mentioned in this comment. If you have additional issues, post a new question and provide your routing and links.menu YAML files.
    – mradcliffe
    May 30 '17 at 21:37
  • I have posted a new question please have a look at it. drupal.stackexchange.com/questions/237507/…
    – Suraj
    Jun 1 '17 at 12:54
2

You should assign your menu link to one of the specific groups on /admin/config by setting the correct path. You can find most of them in system.links.menu.yml and it usually matches the path, e.g. parent: system.admin_config_media.

1
  • 1
    But how would I add my own group, Berdir?
    – EmGee
    Dec 2 '15 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.